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

Performing a FIND and using set field - wont work

Featured Replies

Hello: I have a button that brings the user into the correct layout and enters find mode. The user then types in a date range search 1/1/03...1/23/03 and hits a button to create the report. What I need is for this date range to be copied into a field so it appears on the print layout to show this search range. I tried to use set field then perform find but that didnt do it. How can I do this? Thanks

I would either use two globals, one each for the starting and ending date, or Copy[] and Paste[] this information on a layout which holds both fields.

  • Author

I wanted to use the copy and paste. What I tried to do - the user enters the layout in the find mode, the user types in 1/1/03...10/1/03 into the field and then hits the button to generate the report that script is something like

copy [select,field]

perform find []

paste [select,field2]

I'm using a PC (if that makes a difference). When I try to run this is acts like it cannot find any matching records. I can manually perform the task -- type in date range, then copy then perform find and finally paste in my other field. How could I do this correctly if it can be done?

I tried to use a modify last find but then it omitted the found set but returned the date range! Thank You

Hi:

I would go with JT's suggestion of using two globals for the from and to ranges, then setting your date field to that range. Then you can just put those two globals on your report layout. Just to be clear, the procedure would be something like this:

1. User puts ranges is global date fields: "gFromDate" and "gToDate" and executes find script

2. Script goes:

Enter find mode [ ]

Set Field ["DateField" , "gFromDate & "..." & gToDate"]

Perform Find [ ]

Go To Layout [report]

You might want some error capture in there and other stuff

One small modification to Ken's steps:

Set Field ["DateField", "DateToText( gFromDate ) & "..." & DateToText( gToDate )"]

Dates are actually numbers to FileMaker, so they must be converted to text if you're using them in anything other than a single date calculation.

oops forgot. Good thing somebody's paying attention.

I've done it enough times myself that I remember to check for it now.

  • Author

Thanks for your help guys!!!!!!!!!!

-Queue- said:

One small modification to Ken's steps:

Set Field ["DateField", "DateToText( gFromDate ) & "..." & DateToText( gToDate )"]

Dates are actually numbers to FileMaker, so they must be converted to text if you're using them in anything other than a single date calculation.

Hi Queue ...

Are you sure this will work? I've never been able to use a SetField in Find mode using the method you describe for searching on date ranges. I always get an error message to the effect of "No valid criteria were entered".

Instead, I've always had to go to a Layout (in Find mode) containing the date field being searched on, and use the following:

Insert Calculated Result [ date, DateToText(g_begindate) & "..." & DateToText(g_enddate) ] [ Select entire contents ]

Am I mistaken about this?

mzimm: see attachment

date range search.zip

  • Author

I did not get the setfield method to work. Using Ken's script it only searched on one of the date ranges and Queue's additions gave me some sort of total of the dates and returned a "no records found error".

Jim is right. Use his Insert Calculated Result step in place of the set field. Make sure the date field is on the current layout when the script is executed.

Ken

  • Author

Got it to work! I didnt have the date field in my report layout when I tried to use insert calc results. Thanks for all your help guys!

Mike

Yeah, I wasn't paying attention to the step Ken used, just the parameters in the function. I'd already answered the Insert Calculated Result [ ] question in another thread before this one, and just took it for granted that had already been clarified. Whoops!

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.