K1200 Posted October 16, 2009 Posted October 16, 2009 I have what I thought was a simple scripted find to implement. But after trying about nine different combinations of Find/Omit/Constrain -- and then reading 100 topics here -- I've come up empty handed. Here's a summary: I pass the script a parameter with the Test Type request. The script just needs to locate all of those (Table::TestType = $$Type) entries that haven't been marked Result=X. Table::Result field is a text field that normally holds either a word or a number -- or "X" if the test is invalid. If I find the Test Type first, I can't constrain for "result not equal to X" because that's not a comparison choice. If I find Result=X and then show omitted only, I can't constrain for TestType=$$Type, because variables aren't supported. Am I missing something simple? I hope so. Thanks for any help.
Fitch Posted October 16, 2009 Posted October 16, 2009 It sounds like you might be trying to put your logic into the Perform Find script step, which is not too flexible. It does not take script parameters or variables, only operators and literal text strings. It's generally easier to maintain your scripts if you construct scripted finds like this: Enter Find (do not specify) Set Field( TestType ; $$Type ) Perform Find (do not specify) (I'm not sure what the global variable is doing here: are you setting that to the script parameter that you mentioned?) You could then do a second Find and constrain it, or you could add a Find request to the original search like so: Enter Find (do not specify) Set Field( TestType ; $$Type ) New Record/Request Set Field( Result ; "X" ) Omit Perform Find (do not specify) Maybe the Omit step was the missing puzzle piece?
K1200 Posted October 16, 2009 Author Posted October 16, 2009 Fitch, many thanks. Actually, it was not the omit I was missing, it was the New Record/Request. That's a technique I hadn't seen before. Maybe it has a technical name, but I would call it "stacked finds". Using them this way isn't what I would call intuitive, but it has one overriding quality: it works! For the benefit of others, here's the sequence of steps I've implemented (yes, $$Type contains the script parameter ... the requested test type): Enter Find Mode[] Set Field [Table::TestType; $$Type] New Record/Request Set Field [Table::Result; "X"] Omit Record Perform Find[]
Vaughan Posted October 17, 2009 Posted October 17, 2009 I'll agree that it's not intuitive, but "multiple find requests" have been around since FMP 2.0 in the early 1990s.
K1200 Posted October 17, 2009 Author Posted October 17, 2009 Thank you for mentioning that. Now that I know what they're called, I'll read up on them. I did finally locate a reference in FMP help to "Finding records except those matching criteria" -- but it had no script examples.
Lee Smith Posted October 17, 2009 Posted October 17, 2009 .. it was the New Record/Request. That's a technique I hadn't seen before. Maybe it has a technical name, but I would call it "stacked finds". It already has a "technical name", it is called an OR find. Lee
Recommended Posts
This topic is 5515 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