James Gill Posted December 27, 2010 Posted December 27, 2010 I'm just curious as to the difference between the two scripted find methods that I have found while browsing example files and demos in Filemaker Pro. The first method I was exposed is: Enter Find Mode [] Set Field "Fieldx" (Find Criteria) Perform Find [] vs. Perform Find [RESTORE] Taking in to account a fresh found set, is there any difference between the two? The second method seems cleaner to me but it seems less used than the first method.
comment Posted December 27, 2010 Posted December 27, 2010 The main difference is that Set Field[] can set the field to the result of a calculation. An added bonus is that the criteria are visible when inspecting the script.
James Gill Posted December 27, 2010 Author Posted December 27, 2010 Are there any inherent disadvantages of using the first method over the second? Speed, etc...
comment Posted December 27, 2010 Posted December 27, 2010 Not that I am aware of. Well, three lines of code instead of one. But that's just cosmetics.
bcooney Posted December 28, 2010 Posted December 28, 2010 Not that advice from comment ever needs a second opinion, but I always use method 1, because the criteria is visible in the script. There are often "elegant" methods to accomplish something in FM, that bury your logic. Great when built, but often impossible to troubleshoot six months later. I try to avoid them.
David Jondreau Posted December 28, 2010 Posted December 28, 2010 Until FM11, you couldn't use Perform Find with a $variable, you needed to use Set Field[]. So out of habit I've always done the former. But I have started using the latter recently. For clarity, I comment what the Find criteria are, just like I do for Sorts.
Recommended Posts
This topic is 5077 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