June 20, 201411 yr I use two global fields to find a date range of records. I then use these two global fields to print the date range in the report's header. Here is the script that I'm using: Enter Find Mode [ ] Set Field [ sales::datefield; global::gDateStart&"..."&global::;gDateEnd ] Perform Find [ ] How can I modify this script so I can include a second search criteria? I need to select records within a specific date range that also have this criteria: sales::keyfield="X" Thanks
June 20, 201411 yr Enter Find Mode [ ] Set Field [ sales::datefield; global::gDateStart&"..."&global::;gDateEnd ] Set Field [sales::key field; "X"] Perform Find [ ]
June 20, 201411 yr And for displaying in your report header, you can just use a merge field as: <<global::gDateStart>> - <<global::;gDateEnd>> for <<sales::key field>> ... put it all in the same single merge block. Of course if you want the User to then be able to modify the report title, you would need to use the actual fields instead. But merge is nice because it slides nicely, allows spaces and text easily between, and doesn't allow modification.
June 20, 201411 yr Author Thanks for the idea about using a merge field in my header. Looks nice. I used the script described above and it didn't work. I get the dreaded "No records found" message.
June 20, 201411 yr It should work fine, regardless your FM version. You didn't actually put "X" did you? You would put your key field value there. Add a pause script step immediately after you set the key field and look at the values entered in the three fields. Then make sure you have data to match. Once you get that straightened out, it is also good to include error trapping in your script so you don't get the dreaded "no records found" and instead you provide your user with your own message or handle it however you wish. If still stuck, you can zip and attach your file - it can be an empty clone. Also be sure that you do not have restore on that Perform Find (or Enter Find) which can throw your results. ADDED: Are you still on version 9? If not, please update your profile. And if possible, get FMP Advanced so you can use debugger to see what is going on. :-)
Create an account or sign in to comment