AnsweredAssumed Answered

Script approach to remove find criteria on a field?

Question asked by tkessler45 on Aug 18, 2016
Latest reply on Aug 18, 2016 by philmodjunk

I have a few search criteria that I'd like to be able to choose from in my record set, and then have FileMaker show records including these criteria; however, I'd like to do it via a script.


In my solution I have a field for date, and then a field for "problem type". The problem type is blank by default, but if a problem exists then it can be of "type 1" or "type 2". The date field is always auto-populated.


I have global fields to represent "search values" for these two fields. For the globals, I have "StartDate" and "EndDate", and then I have a global called "TypeSearch" for folks to enter a problem type (by value list).


I am using these globals to provide stereotyped options for a relatively filemaker-naive userbase to select from in order to filter the data in the layouts. I am then attempting to use a script for populating a find request from these globals. The script basically checks for the length of a global and defines a variable as either the global's value, or as "*" if the value is blank. It then uses a "Perform Find" step to apply the values of the variables to their respective field in a search query.


The problem with this is that the use of "*" as the variable omits blank fields in the search, such as might be the case with the problem field above. I cannot use "=" either, as this will simply invert the results. There appears to be no wildcard that "clears" the search on a given field. I have also tried sequential "Perform Find" steps; however, each does not include the results from the prior step.


The "Modify Find" option would work if it was scriptable, but it just changes the mode of the interface to Find. I would prefer to not enter Find mode at all, and rely on script steps to designate values to find, or clear them for a specific field. Is this possible?