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.

Find Script with Parameter

Featured Replies

I want to write a script that will use the same criteria for a find (like ">0") but I want to use a parameter so that I can set the find to a different field each time I use the script. It seems like it would be very easy...I think I'm just overlooking something. But I can't figure out how to write the script so it keeps the criteria for the find but performs that find on a different field(that would be assigned by the parameter). Please help if you can...

Hello

Are you thinking of something like this.

Set Variable[$Field; Value:Get(ActiveFieldName)]

Enter Find Mode[]

Set Field[$Field;">0"]

Perform Find[]

If(Get(LastError)=401)

do something

EndIF

That would be nice - IF it were possible.

  • Author

Phillip:

I tried to use the script that you had but I couldn't get the set field to work... Any other ideas.

Maybe there isn't a way to do it and I have to wirte 10 different scripts. It just seems that there has to be a way you can save a find in a script and apply it to different fields without having to write a new script every time you want to use the find.

Edited by Guest

It's not possible to dynamically specify find criteria or which field to set.

You COULD write one script along the lines of:

If [ Get(ScriptParameter) = 1 ]

 Perform Find [ Specified Find Requests: Find Records; Criteria: Table::Field1: “>0” ] [ Restore ] 

Else If [ Get(ScriptParameter) = 2 ]

 Perform Find [ Specified Find Requests: Find Records; Criteria: Table::Field2: “>0” ] [ Restore ] 

Else If [ Get(ScriptParameter) = 3 ]

...

There are other methods that involve looping between fields on the layout until the field name matches the script parameter - not pretty.

Why should this be needed at all? Usually, such request indicates a problem in the data structure.

  • Author

Thanks for the help...

The finds are to locate errors or things that need to be done in the database--like items entered on an invoice but not billed ...

I just created the finds. It didn't take long.

It's a rather sketchy description, but it seems you could do this with one ErrorCode field, like:

Let ( [

error1 = IsEmpty ( Field1 ) ;

error2 = Field2 > 100 ;

error3 = something and not something else ;

error4 = ...

...

] ;

error1 + 2 * error2 + 4 * error3 + 8 * error4 + 16 * error5 ...

)




And perhaps another field to decipher the code into human language, like:




Case ( Mod ( ErrorCode ; 2 ) ; "Error1: Field1 is empty¶" ) &

Case ( Mod ( Div ( ErrorCode ; 2 ) ; 2 ) ; "Error 002: Field2 is over the limit¶" ) &

Case ( Mod ( Div ( ErrorCode ; 4 ) ; 2 ) ; "Error 003: something is orphaned¶" ) &

Case ( Mod ( Div ( ErrorCode ; 8 ) ; 2 ) ; "Error 004: xyz¶" ) &

....

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.