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.

Hard code Find script

Featured Replies

  • Newbies

I was able to hard code a script "find" in FMP 5. But in FMP 8.5 I am having trouble. I cant seem to create 12 scripts associated with buttons to search for 12 different time periods on the same field.

Hope someone has a little help on this question

Thanks

Welcome to FM Forums! You've come to the best place in the world for FM help!

You should be able to create ONE find script and use script parameters (attached to each button) to specify what you want to find. Example:

Button 1 finds records 15 days prior to today through today. Script parameter would be: 15 0

Button 2 finds records 30 days to 15 days prior. Script parameter would be [color:red]30 16

Button 3 finds records 45 days to 30 days prior. Script parameter would be [color:red]45 31

Find script would be:

Enter Find Mode [ ] ... uncheck pause

Set Field [ yourDateField ; [color:green]Get ( CurrentDate ) - LeftWords ( Get ( ScriptParameter ) ) ; 1 ) & ".." & Get ( CurrentDate ) - RightWords ( Get ( ScriptParameter ) ; 1 ) ]

Perform Find [ ]

Without knowing your specific criteria, this is the best example I can provide. Since vs. 7, script parameters (which allow you to attach a value to an action, namely a button press) are quite handy. Of course there are other ways as well; there always are. Also, I got lazy and used a space between parameters whereas, if I think there might be more than one 'word' on each side, I'd use pipe character and split them more carefully. :wink2:

Update: You can make the calculation (green) a bit more readable by using Let() as:

Let ( [

today = Get ( CurrentDate ) ;

from = LeftWords ( Get ( ScriptParameter ) ;

to = RightWords ( Get ( ScriptParameter )

] ;

today - from & ".." & today - to

) // end Let

Corrected the items in red - the first number should be the OLDEST. I had them reversed, sorry.

Edited by Guest
Corrected red (blush)

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.