Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

searching a date range and a second field

Featured Replies

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

Enter Find Mode [ ]

Set Field [ sales::datefield; global::gDateStart&"..."&global::;gDateEnd ]

Set Field [sales::key field; "X"]

Perform Find [ ]

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.

  • 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.

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.  :-)

  • Author

I got it.... thanks

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.