merkaba22 Posted July 23, 2008 Posted July 23, 2008 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:)
comment Posted July 23, 2008 Posted July 23, 2008 You are skipping records: when you omit a record, you already are on the next record.
David Jondreau Posted July 23, 2008 Posted July 23, 2008 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
comment Posted July 23, 2008 Posted July 23, 2008 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.
merkaba22 Posted July 24, 2008 Author Posted July 24, 2008 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.
David Jondreau Posted July 24, 2008 Posted July 24, 2008 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)
merkaba22 Posted July 24, 2008 Author Posted July 24, 2008 That's great -- I wonder if you could provide an example that I could adapt to my needs?
Søren Dyhr Posted July 24, 2008 Posted July 24, 2008 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
merkaba22 Posted July 24, 2008 Author Posted July 24, 2008 (edited) 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, 2008 by Guest
Søren Dyhr Posted July 24, 2008 Posted July 24, 2008 (edited) 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, 2008 by Guest Had great fun ... being silly!
Recommended Posts
This topic is 6316 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