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.

Script for finding records within a given date range.

Featured Replies

Sadly I've pretty much solved my problem minus my final step.

Within my quote table I have two fields... one being "Search_Day_Start" and "Search_Day_End". Those are both used within a layout I have designed to have different variables you can modify and then clicking on a specific button to generate a report for it.

A simple report that would be generated would taking the two dates selected by the user and then displaying all quotes generated within that time period.

Within that script I broke the dates down into a text format and then used a few other various things to extract the day/month/year.

I would then generate a line of text based upon what I pulled out of the two dates.

3/22/2008 and 3/25/2008 produces the line

{3...3}/{22...25}/{2008...2008}

I have confirmed that this part is working and the correct things are being created. But when I switch to my "report" layout, enter find mode and set the field which is "date_create" (A date type field) to what I generated.. I basically get the issue on the find when it says there is no valid criteria in the request... but if I modify my find and just paste in the text I generated it works fine.

I'm posting a screen of my script to hopefully clear any of my nonsense up!

I'm also not 100% bound to my own script. I'm sure I skinned the cat with a spoon here.

-Jimmy

scriptSS.jpg

If the Search_Day_Start and Search_Day_End fields are date fields, I am pretty sure (I am not at my Filemaker machine right now to test this) that you could simplify this substantially:

# Script to search for date range

Go To Layout["MySearchLayout"]

Enter Find Mode[]

Insert Calculated Result["TheDateField"; Search_Date_Start & "..." & Search_Date_End]

Perform Find[]

The key is to use the Insert Calculated Result script step instead of the Set Field step. You certainly don't have to insert ranges for each part of the date.

David

  • Author

that seems to fix my problem. I'm glad its done in a much cleaner form.

"The key is to use the Insert Calculated Result script step instead of the Set Field step. You certainly don't have to insert ranges for each part of the date."

What is the main difference between these two steps to begin with? Obviously they do behave a bit different and I think it does answer one other question I might have had in the past on a similar issue. When you get into those script steps it appears they both have a prmop to insert a calculated result but I know they are different.

Edited by Guest

There is no reason not use Set Field[] here. Insert Calculated Result[] requires the field to be on the layout.

Older versions of FileMaker did require the Insert workaround. I'm not 100% sure when they changed it, it may be just with FileMaker 9 -- but old habits die hard.

E.g., does everyone know that you can now script Replace without going to a layout with the field on it?

Both since version 7.

Comment--

I see that it works as you mention. Since this was the main reason I knew to use Insert Calculated Result, can you tell me how or where it would now be useful?

Vern--

It used to be that one used the Insert Calculated Result step for entries that wouldn't pass the field's validation (as when one wished to script in a date range in a Find). Obviously, that changed...

David

how or where it would now be useful?

Besides maintaining backward compatibility with scripts written in previous versions, it would be useful for those occasions where you want to insert something at cursor position, while keeping the cursor in the field - such as inserting boiler-plate text.

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.