ron G Posted March 24, 2012 Posted March 24, 2012 I have a membership table. There is a field called Mem_Can that holds either "Member" or "Candidate" There is a field called TYPE which holds the membership 'type' (Life Member, year member etc) After importing records, it is possible for Type to erroneously be "" There is a calculated field called TypeIndex which calculates the numerical position of the 'Type Dropdown' list of types. It holds 2 if the chosen Type is the 2nd choice etc... If a list of Types is imported the stated Type can be wrong. In this case, the TypeIndex is 0 (zero) So, I need a way to PerformFind: Members with a Type of "" OR Members with a TypeIndex of 0 I need a get(foundcount) that shows the total of either of these two situations. I need to do this in a script without user input. (Hence, the Perform Find)
doughemi Posted March 24, 2012 Posted March 24, 2012 Try Enter Find Mode[] Set Field[TypeIndex; ">0"] Set Field[Type; "*"] Perform Find[] Show Omitted Only This uses DeMorgan's Theorem, which says that A or B is the same as not (not A and not . In this case A=( TypeIndex = 0) so not A= (TypeIndex > 0). B = (Type = "") so not B = (Type = *). The two set fields in the same find command perform the and function. The show omitted step performs the final not function.
ron G Posted March 24, 2012 Author Posted March 24, 2012 Is it required that I enter find mode? Can't the script step Perform Find followed by Constrain work? FM seems to 'allow' this combination but noteably it fails to work. To put it another way, "If I wanted all 'Sculptors' who lived in NY, why wouldn't I do a Perform Find where State = "NY" and then Constrain where Artist="Sculptor" ?
doughemi Posted March 24, 2012 Posted March 24, 2012 Constrain is more often used when a found set has previously been defined in a different way, e.g. with a go to related record step; or when you have to do something with a found set, and then do something else with a subset of it. I have noticed that it is a lot slower than a simple find; really noticeable on a hosted database. I find it much easier to follow if I spell out the find criteria rather than use the Perform Find [Restore] with the criteria embedded in the command. This may only be because I •have to• do it that way in the PHP interface to FileMaker. But the criteria in the Perform Find[restore] step don't show up in the script editor--you have to open the script step to see what you were searching for. It is much cleaner just to Enter Find Mode Set Field[state; "ny"] Set Field[artist; "sculptor"] Perform Find[] It does the job quicker, and is easier to troubleshoot down the road.
Lee Smith Posted March 25, 2012 Posted March 25, 2012 It might be a good idea to manually perform the finds first so that you can see the results you are after, and then write the scripts http://www.filemaker...12.html#1028426 Lee
Recommended Posts
This topic is 4627 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now