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.

Featured Replies

Hello All,

I want to script a find based on two fields.  One field is based on a global field and is used 'straight' - I mean the global field's value is "Wider Life" and I want to search for all records with the value "Wider Life"

I have another global field which is user selected {"Awaiting Confirmation"; "Confirmed"; "Rejected"}.  I need to convert this to a single letter {"A"; "C"; "R"} using a Case in a calculated result of a set field like this:

Go to Layout [ “CPD Attendance” (CPD Attendance) ]
Enter Find Mode [ ]
Set Field [ CPD::CPD Type ; CPD::gTypeFilter ]
Set Field [ CPD Attendance::CPD Confirmed ; Let ( [
$Txt = CPD Attendance::gConfirmFilter;
$Sym = Case (
$Txt="Confirmed"; "C";
$Txt="Rejected"; "R";
$Txt="Awaiting Confirmation"; "A";
"@")];
CPD Attendance::CPD Confirmed=$Sym) ]
Show Custom Dialog [ Title: "Find this in CPD_CONFIRMED field"; Message: $Sym; Default Button: “OK”, Commit: “Yes” ]
Perform Find [ ]

In the script debugger I can see that my temp variable $Sym has the value "A" as expected and the debugging custom dialogue returns "A" but the value "0" (Zero) is entered in the field for the find.  The field type is set as Text.

Any ideas what the problem is?  Thanks very much!

Ben

 

SShot.png

Edited by benmort81

The problem is the result expression of your Let(); it doesn't return $sym, but the Boolean result (0 or 1) of a comparison between $sym and the original global field, and that result is entered as search criterion – while what you want is simply (the value of) $sym.

Note that you shouldn't create $vars in Let() without reason – and that declaring a $var in the result calculation of a Set Variable[] that creates a $var of the same name is confusing, to say the least …

You could change your script/calculation to

Set Variable [ $sym ; 
Let ( 
  theFilter = CPD Attendance::gConfirmFilter;
  Case (
    theFilter = "Confirmed" ; "C" ;
    theFilter = "Rejected" ; "R" ;
    theFilter = "Awaiting Confirmation"; "A";
    "@"
  )
)
]
Set Field [ CPD Attendance::CPD Confirmed ; $sym ] 
Show Custom Dialog [ … Message: $sym; … ]

 

Edited by eos

  • Author

Ah, that is much neater and makes sense!

Thanks again!

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.