paulmetzger Posted December 10, 2002 Posted December 10, 2002 I am writing a report which needs to exclude records which have x in field X (boolean OR) have y in field Y. I did this in find mode by making a request to omit records with x in X and added a second request to omit records with y in Y. So far so good. Here's my problem: My report generating script goes to find mode, and then pauses on a layout so the user can enter the ID number they want the report on. Then the script does the find, returning a set of all records with that ID number. Problem is that this find wipes out the original find that gave me the set of records I need it limited to. Can I script it so the find will happen WITHIN the original found set? As a workaround I just exported my found set to a new file, and generate the reports from that. Works, but not what I want to have to do every time I print a report. TIA, Paul
BobWeaver Posted December 10, 2002 Posted December 10, 2002 Are you using version 6? If so, then you want to use the constrain option to limit the find to the existing found set. If not using version 6, this is an excellent reason to upgrade. Otherwise, you can set a special flag field to mark the records in your original found set and then include this flag field in the next find operation. However, this can create problems if it is a multi-user database, since you could have two users marking the flag field for different sets of records at the same time.
paulmetzger Posted December 10, 2002 Author Posted December 10, 2002 Nope, sadly running 5.5. But the boss did just ask today if it would be worth upgrading to 6. I guess now I can tell him it is. Know offhand where we could find the best price for the 5.5 -> 6 upgrade (educational)? Tell me if I have the flag idea right: I'd created a calculation field called something like "include", and set it Yes or No based on the contents of my other fields. Then when I'm doing the seach in the script, I'd SetField include, Yes in addition to the user entering the id number they want?
jasonwood Posted December 10, 2002 Posted December 10, 2002 Maybe I misunderstood you... (what are the chances that I thought of something that Bob missed? ...slim at best) but here it goes... The script enters find mode, and waits for the user to press enter (or a button to resume the script) Instead of having perform find as your next script step, add in the steps to create the additional requests and the criteria (y's and x's). Then perform find. Does that help?
paulmetzger Posted December 10, 2002 Author Posted December 10, 2002 -- Instead of having perform find as your next script step, add in the steps to create the additional requests and the criteria (y's and x's). Then perform find. -- That sounds great, but how do add those requests to my script?
jasonwood Posted December 10, 2002 Posted December 10, 2002 The whole script would look something like this: Enter find mode Pause (waits for user to hit enter) New Record/Request Set field, Y, "y" New Record/Request Set field, X, "x" Perform find
Vaughan Posted December 10, 2002 Posted December 10, 2002 Let's go back to basics. To perform a find within a found set, the user needs to add to the original find request. To do this, first call up the original find equest with the "Modify Last Find" script step. then the user can add or modify the requests to their hearts desire.
jasonwood Posted December 10, 2002 Posted December 10, 2002 Yes, but in this case it sounds like Paul ALWAYS wants the script to find: The user's criteria; and X = x; and Y = y The fact that he is currently finding the X=x and Y=y isn't really important then (and he wouldn't need to do this anymore) The method I suggested might make more sense if only because the user will never see (and potentially be able to modify) the other two requests.
paulmetzger Posted December 11, 2002 Author Posted December 11, 2002 Here's the problem with doing New Record/Request Set field, Y, "y" New Record/Request Set field, X, "x" Perform find as Jason suggested is that i need to OMIT those records. I'm not seeing anything in scriptmaker (fmp5.5) that lets me do this.
jasonwood Posted December 11, 2002 Posted December 11, 2002 Ahhh of course. Then I think what you should do is perform the find manually (omit x/y) then set your script to restore find requests. Enter find mode (restore find requests) New record/request I believe this will restore your find requests (with the omit option), then create a third blank find request for your users. The problem with this is like I said... users will be able to modify the other two find requests. Anybody know a way around this? Perhaps a way to script the "omit" box?
RussBaker Posted December 12, 2002 Posted December 12, 2002 You script the Omit box by doing this: Enter Find Mode [] SetField[YourField1, Criteria 1] New Record/Request SetField[YourField2, Criteria 2] Omit Record/Request Perform Find [] This will find all the records which have Criteria 1 in field 1 but omit the records which have criteria 2 in field 2. The Omit find should also be the last step in the find sequence. You can stack up as many as you like. For this to work, the Status Area can be either showing or hidden - BUT it must not be locked.
jasonwood Posted December 12, 2002 Posted December 12, 2002 Oh sweet! I never noticed the Omit script step!
ibiubu Posted December 16, 2002 Posted December 16, 2002 I might be adding my two cents worth too late, but here is how I got a script to do a find in a found set for my database: Allow user abort off Perform Subscript (this is a script programmed to do a predetermined find to create my found set) Enter find mode [pause] Perform Find [constrain found set] If[status(CurrentError)=400] Show Message["You did not enter any find criteria; all records will be displayed."] Perform Script (A script set to return the user to a predetermined previous state) Else If[status(CurrentFoundCount)=0] Show Message["No records match this request. All open jobs will be displayed."] Perform Script (A script set to return the user to a predetermined previous state) End If End If Basically what this does is the user hits the button with the find script. A predetermined find is done to create a found set, then the user enters find mode where they perform a search that only takes place in the found set. If nothing matches their find, a message appears letting them know this, then they are returned to a predetermined found set. If they enter nothing for the find, a message tells them this, and once again they are returned to a pre-determined found set. If the find yields results, those results are displayed. Larry
Recommended Posts
This topic is 8354 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