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.

Date range find using custom dialog

Featured Replies

  • Newbies

Hi, I could do with some help/advice please.

I want to create a report layout in which my users can veiw their results, after they have performed a date range find via a custom dialog box (the field to search is a date type field). My question is: how do I set this script up so that my users can enter their search criteria (date range)when promted into my custom dialog box? Hope I've made sense? Your help is appreciated. Many thanks.

Custom Dialog[] has tabs for input data. You would use two global fields (which can exist anywhere in your file and don't have to be related in any way). gStart and gEnd. 'Show Input Field #1' would point to gStart and text would say, "Enter start date". Repeat for input Field#2. Script can even pre-fill a start and end date if you wish or ... if you leave either date blank, FM will handle it for you.

Pseudo-script would look something like this:

Show Custom Dialog [ OK ; Cancel ; "Enter your date range" ]

If [ Get ( LastMessageChoice ) = 2 // user selected cancel ]

Halt Script (or do whatever you wish if user doesn't want to continue

Else

Enter Find Mode [ uncheck pause ]

Set Field [ yourDateField ; gStart & ".." & gEnd ]

Set Error Capture [ On ]

Perform Find [ ]

If [ not Get ( LastError ) ]

... do what you wish with found set

End If

Note that when date ranges, it isn't necessary to have a start and end date. FM would accept ...9/30/2010 and presume all PRIOR dates; or it could end up looking like 9/1/2010... and FM will presume all dates after that date. Or you can prefill with starting fiscal date or even prefill with standard current months range. Options are endless. Setting the globals before your Custom Dialog[] allows users to see the default setting and can save them time if a standard default is the norm.

  • Author
  • Newbies

Many thanks for your help.

I understand the example script that you have posted from a logical point of veiw, however, I am relatively new to FM and I have little knowledge of globals (and their function/useage) and the set field step. Can you tell me how the globals could work in relation to my already present date field? and can the globals be hidden in the layout? Many thanks, Simon.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.