AnsweredAssumed Answered

Show/Hide contraint found set

Question asked by Matty_1 on May 10, 2013
Latest reply on May 10, 2013 by Matty_1


Show/Hide contraint found set


     I have a long list of records that gets sorted and filtered by a date range once you've selected a date in a global field called DateSelectorFirst.  A script then then records that date, adds 4 days to the selected date, drops it into a another field called DateSelectorLast, performs a find like so ( DateSelectorFirst & "..." & DateSelectorLast ) and then sorts the found set.

     I've also created a second global field called ShowHideComplete that is emtpy originally but after running the script once then contains "Hide Complete" or "Show Complete" depending on whether you've hidden or see the completed jobs.  When the field contains Hide Complete and is clicked on it performs a constrain found set that omits all records marked as complete and changes itself to Show Complete.  Again, if you click on the field and it shows Show Complete the script performs the original script that found the date range.

     My problem is with the global field.  Right now even after shutting down FileMaker it seems to retain the show/hide along with which records where last found but I don't think that will be the case once it is shared over the network.  If that is the case then I'm wondering if someone could help me come up with a solution that will have the global field properly show the information when the user first enters the layout because the global field remains empty before it gets clicked on.  I thought of doing a on layout enter script but because all the information is retained even after I shut down the software I have no way of testing it.  So I'm wondering if the following makes sense, I have little experience with global variables so I don't know how exactly they work and when they no longer become active over a network share.

     I'll have a global variable called $$ScriptRun.

     When the OnLayoutEnter script starts it will verify if the $$Sciript is equal to no.  Is so then it will do nothing, if it's anything but no then it will show all records, mark the global ShowHideComplete field as "Hide Complete" and mark the global variable $$ScriptRun to "No" this would stop it from showing all records the next time the user navigates to the page for the duration of his session.

     Do I have to do a show all records or will they be showing all by default?  If I recall correctly when a database is shared over the network, it does not retain your last found set correct?  If that is correct then I can do away with the show all and simply have it check to see if the script has been run once nefore in this session right?