Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

another topic for criteriaFind

 
Allen Chan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am still not clear about how we should handle the criteriaFind, obviously we should be able to perform a search by entering criteria (by entering into a text area or textfield)
"FLightNo='PA001',Destination='SFO', ...", but do we need to put two (or more combobox) there and let them select the flightno, dest, from, etc. After select they could start search
thanks,
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi allen,
my solution looks like this. The user can provide 6 criterias to search for a flight.
1. Flight Number -> TextField
2. Origin -> ComboBx dynamically filled with the distinct values of the corresponding column
3. Destination -> ComboBox dynamically filled with the distinct values of the corresponding column
4. Carrier -> ComboBox dynamically filled with the distinct values of the corresponding column
5. Day -> ComboBox static string array of all days of the week
6. Time -> TextField
With this information I build the criteria string, e.g. something like origin='SFO',day='Sun'
This string gets parsed, I check which column number is e.g origin and put column number and argument in a map. The map then looks something like this {1=SFO, 2=DEN, ... } Using column numbers is easier I think for comparing because they correspond to the index in DataInfo object.
The searching looks like this:

Hope this helps.
jay
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi allen,
My implementation looks like this:

I have a Criteria and Constraint class.
When the user click on the search action, the search dialog appears. The search fields displayed into this dialog is not hard-coded, but they are retrevied from the table column model, so if (for example) the underlying business object change, the search dialogs change with it.
The Search Dialog contains n pairs label/textfield
(the label show the property name and the textfield is the entry field). Each of these represents a "Constraint". The toString() method of the Constraint class returns:
name='value'
All the constraints are managed (and contained into) by the Criteria class. The toString() of the Criteria class returns:
name1='value',name2='value',name3='value'
So the congruency search control are delegated to each Constraint object and a general check is performed by the Criteria object.
Greetings
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic