December 9, 201411 yr 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!
December 9, 201411 yr 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 [ ]
December 9, 201411 yr 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 December 10, 201411 yr by LaRetta
December 10, 201411 yr Hi LaRetta. I think it creates a AND find? Constraining (narrowing) a found set.
December 10, 201411 yr 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. :-)
Create an account or sign in to comment