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.

Need help with date find in script for button

Featured Replies

Hi. I am trying to create a button which will perform a find asking the user to input two dates which they want the records to be between, then to switch to the other layout with the found records. When i go to scriptmaker, i have perform find as the first action with the find request being "Date >= ?" and it won't accept it. how do i get it to ask the user for the dates they want?

Create two global fields, globStartDate and globEndDate

For the script:

Show Custom Dialog (show the two global fields for the user to put a start and end date)

Go To Layout[Whatever layout it should go to]

Enter find mode [No Pause]

Set Field [Date; globStartDate & "..." & GlobEndDate]

Perform Find

That should do it =)

-----

Martha :bigshades:

  • Author

What should the globStartDate and globEndDate fields be? just empty or should they be calculations or something? please elaborate on that aspect. thanks.

Sorry about that!

globStartDate and globEndDate should be date fields that are global but not calculations so leave them empty.

Also, a note on the script I told you to create:

Before showing the dialog, you can do the following:

If(globStartDate = "")

SetField[globStartDate; Get(CurrentDate)]

End if

If(globEndDate = "")

SetField[globEndDate; Get(CurrentDate)]

End if

That will set values in the two fields if they are emptyo so that when the pop-up comes up, the two fields won't be empty, and it makes it easier for the user to know the date format. The above script steps set them to today's date but you could create a calculation to set them to something else.

Does that clarify?

  • Author

I got the find to work without the global field, but it does not work in web companion.

  • Author

That actually confused me more! I do not want and static dates in the script. I want the user to input them when running the report script. does that still apply?

Okay.

The global fields are temporary places to put the start date and end date that the user enters for the find.

So after putting a custom dialog box up that asks for start date (globStartDate) and end date (globEndDate), the script can go to the correct layout, enter find mode, set the Date field as globStartDate & "..." & globEndDate, and perform the find. This shows the user only records within those dates.

You can ignore my second post because it's just extra. All it is saying is that you can set the two global fields as some date, so that when the dialog comes up, the two fields won't be empty. So it will say something like:

Please Enter Start and End Dates.

Start Date: 04/11/04

End Date: 04/11/04

HOWEVER, the user will be able to change these dates, so that they will get the right time period they want.

Do you have a file I can look at? That might be more useful.

I got the find to work without the global field, but it does not work in web companion.

Hm... this isn't true, please explain!!!

--sd

  • Author

Aaah i understand finally! ok, i put everything in, but am having problems properly inputting the following line in the script

Set Field [Date; globStartDate & "..." & GlobEndDate]

I put in Set Field [Date]

because that is all i can put in and i keep getting errors.

"There are no valid criteria in this request. Type a valid request before clicking find. Can i email you the file though this? let me know.

I put in Set Field [Date]

because that is all i can put in and i keep getting errors.

Set Field [Date]

Then you want to click on "Calculated Result" and enter

globStartDate & "..." & GlobEndDate

  • Author

Beautiful! that worked perfectly! thank you so very very much!

  • Author

Søren Dyhr ,

The script works in FileMaker Pro but not in IWP. I am testing it with administrator privileges and it just stays on the same layout in IWP. Please help. thanks.

  • Author

Can you recommend an IWP compatible line replacement for

Show Custom Dialog (show the two global fields for the user to put a start and end date)

Ah that's what you comment meant, thats right IWP are bound to have a layout for that.

--sd

I'm taking a wild guess here becasue I don't use IWP...

Can you put the two global fields at the top of your layout and that way the user can enter the dates and then click a button to run the rest of the script?

Start Date __________ End Date __________ |Run Report|

  • Author

that sounds like a good work around. thanks.

Well if that's an acceptable approach, shouldn't it be scripted either but instead filling a portal via a multicriteria relationship, and the run button's script could be reduced to Commit Record.

The reason I say this is that earlier versions had a limitation in listview, preventing more than 5 records shown in listmode, however is this limitation changed, but we used to work around in IWP via a selfjoin portal shown. The workaround isn't in demand any more.

--sd

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.