Okay, so to expand on my original reply,
Add at least two rules.
100: entity.name = "Employee" and propertyKey = "employmentTitle" =>
componentName = ERD2WEditToOneRelationship [Assignment]
100: entity.name = "Employee" and propertyKey = "employmentTitle" =>
restrictedChoiceKey = object.currentTitles [Assignment]
Then in your Employee.java add a method like:
public NSArray<EmploymentTitle> currentTitles() {
NSArray<EmploymentTitle> employmentTitleList =
EmploymentTitle.fetchEmploymentTitles(
editingContext(),
EmploymentTitle.IS_CURRENT.eq(true),
EmploymentTitle.ORDERING_INT.ascs());
return employmentTitleList;
}
Optionally, you can set a key to be the value displayed in the popup list. Say
your employment title entity has an attribute named titleName, you would do it
using a rule like
100: (propertyType = 'r' and relationship.destinationEntity.name =
'EmploymentTitle') => keyWhenRelationship = "titleName"
By default, the rule system will use the userPresentableDescription() method on
your eo. So you could just do that in your EO:
public String userPresentableDescription() {
return valueForKey("titleName");
}
You can also localize the values if you like, using a rule like:
100: (propertyType = 'r' and relationship.destinationEntity.name =
'EmploymentTitle') => localizeDisplayKeys = true [BooleanAssignment]
So if one employee title is "Manager" then in your french localizable strings
file you would have
"Manager" = "Gestionnaire";
And your popup values would be localized. You might instead prefer to use
localized columns in your database for larger datasets. You can do that using
the ERXLanguages userInfo key in your eomodel. That's up to you.
Ramsey
On Dec 15, 2011, at 8:28 AM, Ramsey Gurley wrote:
> Hi Ted,
>
> componentName = ERD2WEditToOneRelationship
> restrictedChoiceKey = object.currentTitles
>
> Then create a method on your object returning an array of current employment
> titles like you have below.
>
> Ramsey
>
> On Dec 15, 2011, at 8:03 AM, Theodore Petrosky wrote:
>
>> OK so this is a real newbie thing.
>>
>> In my Wonder app, I would:
>>
>> create a list of entries to populate a popup
>>
>> employmentTitleList = EmploymentTitle.fetchEmploymentTitles(newEmployeeEC,
>> EmploymentTitle.IS_CURRENT.eq(true), EmploymentTitle.ORDERING_INT.ascs());
>>
>> I don't understand how to do this in an Edit page in D2W.
>>
>> Is there anything like this in an example?
>>
>> Ted
>> _______________________________________________
>> 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/ramseygurley%40gmail.com
>>
>> This email sent to [email protected]
>
> _______________________________________________
> 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/rgurley%40smarthealth.com
>
> This email sent to [email protected]
_______________________________________________
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]