On Feb 19, 2010, at 7:46 PM, Pascal Robert wrote:

I'm trying to hide some text if an array is empty, so I tried this :

<wo:WOConditional condition = "$member.organizationProfiles.isEmpty">

But I'm getting :

<org.wocommunity.logic.eof.OrganizationProfile 0x40964823> valueForKey(): lookup of unknown key: 'isEmpty'. This class does not have an instance variable of the name isEmpty or _isEmpty, nor a method of the name isEmpty, _isEmpty, getIsEmpty, or _getIsEmpty

Why it's trying to find isEmpty on a OrganizationProfile instead of the array (which is populated with OrganizationProfile objects)?

See the valueForKey docs on NSArray:

For keys which do not begin with "@", valueForKey creates a new array with the same number of elements as this array. For each element, the corresponding element in the new array is the result of invoking valueForKeyPath with key as the key path on the element. For example, if key is "firstName", this method returns an array containing the firstName values for each of the array's elements. The key argument can be a key path of the form relationship.property. For example, "department.name". valueForKey replaces null values with an instance of NSKeyValueCoding.Null.

$member.organizationProfiles.isEmpty results in an array filled with the result of anOrganizationProfile.isEmpty

Chuck



So far, the only way I found to check if it's empty with non-Java code was with :

OrgsProCondition : WOConditional {
  condition = member.organizationsprofil...@count > 0;
  negate = true;
}

I also tried with :

<wo:WOConditional condition = "$member.organizationprofil...@count > 0">

But I get a "has a quote left open", and using &gt; didn't help.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [email protected]

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to