Main Menu
Lecture 1
Lecture 2
Lecture 4
Lecture 5
Lecture 6
Lecture 7
 

 

 

Further qualifying the Query

Change the condition of the fetch spec in EOModeler so that we search via the subjects the students is in.

So the fecth spec would look like this :
(subjects.subjectname like $lastName)

This means that the list of students that are returned are enrolled in a subject that contains "lastName".

Getting the qualifier value at run time

We want to get the qualifier from web page, not hard coded as we have been doing. i.e. we want the user to be able to type into a textfield the criteria for their search.

So we :

1. Add a textfield

2. Add a new key to the component - bindings of type NSMutableDictionary

3. Bind the text entry field - THIS CANT BE DONE GRAPHICALLY

We will have to use the inspector to type in bindings.lastName in the value field

The dictionary is expecting a key value pair: the key is lastName, and the value is what you type in on the page

4. Change the action the submit button is bound to so that it includes this code :

public WOComponent GetTitle()
{
studentlist = EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "Student", "studentSearch", bindings);
return context().page();
}

5. Modify the Java code

The declaration of bindings is moved outside the constructor

The constructor still allocates memory for bindings

Select from "Art 101", "Computers 101", and "Music 101" in demo5

Lecture 3 Fetch Demo 5 ( Download )