July 23, 200817 yr As a building block for a larger script meant to replace a "find": Go To layout Show all records Go to Record/Request/Page [First] If [Managers::reference = "yes"] Omit Record End If Loop Go to Record/Request/Page [Next, exit after last] If [Managers::reference = "yes"] Omit Record End If End Loop Show Omitted Only A "find" for all records where reference = "yes" yields 20 records in the found set. Using the above script yields 15 records in the found set. What am I missing in this script? Thank you in advance:)
July 23, 200817 yr You are skipping records: when you omit a record, you already are on the next record.
July 23, 200817 yr When two Yes records are consecutive, you are keeping the second one because you always Go To Next Record at the beginning of the Loop, even if it's a record that hasn't been tested yet by the If because of the Omit. Try: Go To layout Show all records Go to Record/Request/Page [First] Loop If [Managers::reference = "yes"] Omit Record Else Go To Record Next [Exit After Last] End If End Loop Show Omitted Only
July 23, 200817 yr Of course this is assuming there aren't any records that contain words that begin with "yes", but aren't exactly equal to "yes" - that would further increase the discrepancy. BTW, what's the purpose here? A find is much faster and efficient since it's using the field's index.
July 24, 200817 yr Author I will give this a shot tomorrow -- thanks. The purpose is to loop through a set of records, omitting by several criteria via several loops and to show omitted -- rather "finds" which may ask the user to continue, cancel, etc. if the "find" does not meet the criteria -- ie. to have script that will finish no matter what.
July 24, 200817 yr I can see how having unneeded dialog boxes can be annoying. Michael's right though, this should be done as a Find. Your problem can be solved by using other Filemaker script steps and functions to customize error messages or supress them entirely. Check Out: Allow User Abort [Off] Set Error Capture[On] Show Custom Dialog[] Get(LastMessageChoice) Get(LastErrorMessage)
July 24, 200817 yr Author That's great -- I wonder if you could provide an example that I could adapt to my needs?
July 24, 200817 yr Set Error Capture [ On ] Enter Find Mode [ ] Set Field [ Invoice::Managers::reference; "Yes" ] Perform Find [ ] If [ Get ( LastError ) ] Show All Records Show Custom Dialog [ Message: "Nothing found"; Buttons: “OK” ] End If Set Error Capture [ Off ] E.g. --sd
July 24, 200817 yr Author That's great but I think your example will generate a dialog box requiring the user to respond, to select "OK"-- the point of the omit script is to avoid this; especially in the case where there are multiple (criteria) loops -- as I understand this example, the user would be required to respond to each such prompting when no records are found for each loop/step of the script. Do I misunderstand? Edited July 24, 200817 yr by Guest
July 24, 200817 yr Hopefully are you not pursuing something as silly as the above?? Lets just say it's something dedicated to: http://www.fmforums.com/forum/showuser.php?uid/34454/ Who apparently gets lost in her relational graph, so the less the better :,) To your question - remove the dialog and make the request: Set Error Capture [ On ] Enter Find Mode [ ] Set Field [ Managers::reference; "Yes" ] Perform Find [ ] Set Error Capture [ Off ] I'm not getting the reason why it has to be looped, unless you inside the building of the request needs to fill several fields in an AND'ed mode, but then is it just to use a series of the same set field step ushered from field to field by Go To Next Field ... but the dependency of a facilitating layout providing enough fields, is not the strongest technique known to mankind. Explain yourself here! --sd Requestbuilder.zip Edited July 24, 200817 yr by Guest Had great fun ... being silly!
Create an account or sign in to comment