Perform a search on a calculated field

In the database I have a field “day_of_week” with numbers from 1 to 7. In Servoy I use a calculation to display “Monday” for 1, “Tuesday” for 2 etc. on the GUI. If i switch to Find mode, enter “Monday” in the Day Field, all records show.
It seems obvious to me that the find doesn’t work like that, but before scripting the search, I would like to ask if there’s a way to use the find mode on calculated fields (using cmd-F is sometimes very nice :wink:).

In this particular case, I will probably just change the database field to hold “Monday” etc and make my life easier. However, the same problem occurs with other calculated fields, e.g. when using lookups with IDs and the like…

Any suggestions are appreciated! Thanks,
Reto

You need to make the calculation a STORED calculation.

Here’s how:

  1. Create a new column for each field you want to “store” (I recommend using the same names as you already have for your calculations);

  2. Rather than type in a free-form name for your calculation (on the calculation tab in Define DataProviders) - use the pop-up menu to select that column.

The results of your calculation will now be STORED in the database - and you can search on them like any other column.

Hope this helps,

Bob Cusick