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.

Finding dates in the last 30 days

Featured Replies

  • Newbies

Hi all - hope you can help.

I'm creating a report in which I want the first step to be to perform a find on a date field to find all dates in the last 30 days. How do I set a find criteria that is effectively 'today...today-30'?

Thanks!

Set Field [dateField; "≥" & Get(CurrentDate) - 30]

  • Author
  • Newbies

Thanks for this - but I can't see how to apply it... Do I create one script step to set the field, then another to perform the find? Every way I've tried to enter this, FM throws up an error... sorry to be dumb, but can you explain how to create the script in FM7 or 8 in a bit more detail?

Many thanks!

Sure.

Allow User Abort [Off]

Set Error Capture [On]

Enter Find Mode [ ]

Set Field [dateField; "≥" & Get(CurrentDate) - 30] {first parameter is target field; second is calculation}

Perform Find []

If [not Get(FoundCount)]

Modify Last Find

Show Custom Dialog ["No records were found for the given date range."]

Show All Records

End If

Perhaps,

  SetField[ dateField, ">=" & GetAsDate( Get(CurrentDate) - 30 )]

will work better?

I assume you meant GetAsText, since it is already a date. However, 7 auto-converts the expression, so GetAsText is superfluous.

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.