2 Replies Latest reply on Apr 6, 2010 2:55 PM by Radcon

    Need some Conditional Value list finesse



      Need some Conditional Value list finesse


      I have succeeded in getting a conditional value list to work, but not quite as good as I would like. The options chosen in field_one dictate the available options in field_two. That part works good.  Where it fails is when one chooses a different option in field_one, but doesn't click in field_two to choose one of the more appropriate options. I need the options available with field_one>choice_one to always be mutually exclusive to the options available with field_one>choice_two, even if no changes are attempted in field_two. 

      I tried an OnObjectModify script trigger on field_one, but couldn't get that to behave either.



        • 1. Re: Need some Conditional Value list finesse

          With Pop up menus, check boxes and radio button formats, use OnObjectModify. With Drop down lists, OnObjectExit usually works better (with drop downs, you can type text in the fields and you don't want this script to fire with each keystroke.)


          A simple "brute force" approach is for your Field_one trigger to have a single line:


          Set Field [ Table::Field2 ; "" ]


          This clears field2 everytime some one modifies/exits field1.


          A more sophisticated script can be set up to clear field2 only if it is not a member of the value list for field 1. You can combine the valuelistItems and FilterValues functions to do this:


          If [ IsEmpty ( FilterValues ( ValueListItems ( Get ( filename ) ; "YourValueListNameinQuotes" ) ; Field_two ) ) ]

            Set Field [ Table::Field_two ; "" ]

          End If


          Note: you can put the databae file name in quotes in place of Get (Filename) but then renaming your file will cause this function to fail. In either case, renaming your value list will cause ValueListItems to fail until you update it to refer to the new name.

          • 2. Re: Need some Conditional Value list finesse

            Thank you Phil;

            Your brute force approach did the trick. Sophistication is nice, but I need simple solutions.:smileywink:  I added a GoTo(theSecondaryField) script step.  These fields were not on the default tab of a two tab layout, and every time a user clicked out of the primary field, the default tab would show up before the user would see the secondary field.


            Your insight into the best suited script triggers helped a lot also; I really appreciate you adding that extra bit of information.


            Thanks again!