Re: Help with WOPopUpButton
Re: Help with WOPopUpButton
- Subject: Re: Help with WOPopUpButton
- From: Art Isbell <email@hidden>
- Date: Wed, 11 Dec 2002 08:27:48 -1000
On Wednesday, December 11, 2002, at 04:46 AM, Reid Bundonis wrote:
public TreatmentResults searchByState() {
TreatmentResults nextPage =
(TreatmentResults)pageWithName("TreatmentResults");
//Tried creating a String (selectedState) and binding it to
selection... nextPage.setStateToFind(selectedState);
selectedState will be a State object, not the stateName attribute of
the State object. So if you really want to pass the stateName string
rather than the State object, try:
nextPage.setStateToFind(selectedState.stateName());
nextPage.fetchCenters();
return nextPage;
}
Then on the Results page, I created the fetchCenters method to receive
the value of selectedState, I thought...
public WOComponent fetchCenters() {
NSArray bindings = new NSArray( new Object [] { selectedState
} );
EOQualifier qu =
EOQualifier.qualifierWithQualifierFormat("state.stateName = %@",
bindings );
fs = new EOFetchSpecification("TreatmentCenter", qu, null);
It appears that the TreatmentCenter entity has a relationship named
"state". In this case, why bother qualifying on the stateName?
Instead, leave your searchByState() implementation unchanged but change
your qualifier:
EOQualifier qu =
EOQualifier.qualifierWithQualifierFormat("state = %@", bindings );
The above is an example of what happens because most of us came to EOF
from the traditional database client programming world in which we
dealt the database tables, rows, foreign keys, primary keys, etc.
instead of objects. In EOF, we don't have to qualify by a column value
(e.g., State.stateName) but instead can qualify by the relationship
value (e.g., TreatmentCenter.state), something that's not explicit in a
relational database.
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.