I don't understand quite yet the Summary elements in FM.
I have several button segments that open corresponding layouts with found sets or list of records of found sets. I want to see the total number of items that would be in the found set if the found function was runned. These buttons are repeated on several pages and depending on what is being selected in the relevant field, the count will varie.
E.g.
Button must show : |
---|
Pending Initial Review (5) |
Here is the calculation that I hoped would create that name (it returns a ?)
"Pending Initial Review (" &
ExecuteSQL ("SELECT COUNT( \"Dossiers::OccurencesPIR\" ) FROM \"Dossiers\" WHERE \"Dossiers::StepRP\" =?"; ""; ""; "Pending Initial Review") &
")"
Dossiers::OccurencesPIR is a summary field (option count selected, running count checked)
I have placed the OccurencesPIR field on the Layout that corresponds to the table Dossiers to monitor the number. It shows the number of values found in the OccurencesPIR field of the active found set rather than the whole DB.
I am not quite sure how to go from here.
The problem is that you are counting a summary field. Count a field that will always be there i.e. a primary key.
Be careful though because calcualtions like this will run over and over every time you change records. It might be better to run a script on a script trigger when you enter the layout that sets some global variables and then reference those global variables in your button names. That will not cause a slow down in your database like your current method may.
If you are concerned about the data changing frequently then you can always set an timer script to run every 5-10 (or whatever) minutes to update the global variables and refresh the individual objects that are effected by the global variables. This will still be MUCH less than the calculations will run if they are just live on a button.