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.

Constraining with multiple checkbox values

Featured Replies

I'm stuck. I have a checkbox'd text field (Phase__lxt_) with five values in it (I, II, II, IV, and ALT) to select from where I want users to be able to click one or more checkboxes to constrain found records having one or more of those values.

 

The problem is, I'm having trouble figuring out how to set up a script/calc for multiple value choices; single value choice is easy, but short of creating separate script iterations for each possible combination of checkbox seems incredibly clunky to me. 

 

I get that I'll need to parse the field in some way where I'll use FilterValues, PatternCount and such, but whatever the calc ends up being it'll have to ignore the order in which the checkboxes were checked.

 

As always, your help/guidance is greatly appreciated!

Constraining to multiple values does not work - meaning you already have a found set and you want to use Constrain script step to reduce the found set to all the values in a checkbox.  Instead, find all these values and then Extend or Constrain by additional criteria. Use a global text to hold the user-selected values with a value list attached as a checkbox, called gPhase and then loop and create multiple find requests, similar to this pseudo-script:

# Make sure there is a value in the global text
If [ IsEmpty ( table::gPhase ) ]
Show Custom Dialog [ Message: "No value entered "; Buttons: “OK” ]
Halt Script
Else
# count values in the global and loop them
Set Variable [ $valueCount ; ValueCount ( table::gPhase ) ]
Enter Find Mode [  ]
Loop
Exit Loop If [ Let ( $count = $count + 1 ; $count > $valueCount ]
# one new record/request for each value
New Record/Request
Set Field [ table::Phase_lxt_ ; GetValue ( gPhase ; $count ) ]
End Loop
End If
#
Set Error Capture [ On ]
Perform Find [  ]

Each new find request create an OR condition meaning records with ANY of the checked values will be found.  If you want a find which returns records only if ALL of the criteria is included, just one find will work based upon the global checkbox; which creates an AND find.

 

Edited ... 

Edited by LaRetta

Hi Lee,

 

When searching the same field for multiple values, a Constrain would fail.  If you constrain down to the first value, then attempt to constrain down to the second value, it would never return a result because it already has constrained the record set to only the first value.

 

So what you reference IS correct - when searching different fields but that's why I said a constrain would not work on checkbox and instead it works best to perform multiple find requests, creating an OR condition, as ... search the checkbox for value 1 OR value 2 OR value 3 (regardless of their order in the checkbox)  ... and if you wish to constrain to certain date range (for example) THEN constrain the existing found records to the date range.  

 

I appreciate you speaking up because I see that I DID mis-speak in mentioning the AND find on checkbox.  It would fail unless the checkbox was in same order.  Thanks for speaking up and I'll delete my AND reference above. :-)

  • Author

Ah! Thank you both! :D

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.