3 Replies Latest reply on Feb 16, 2012 6:37 AM by philmodjunk

    Set Variable Based on  Value List



      Set Variable Based on  Value List


      Hello everyone,


      I am trying to set a variable REGION based on whether or not another variable STATE is found in a value list of each of the states in various regions.  E.g. Value List Region_Northeast contains [CT, DE, ME, MD, MA, MJ, NY, PA, RI, VT], with a similar list for each region.  So if the user enters in CT into the field STATE, I want to automatically set REGION to "Northeast" and likewise for each region.  What is the best way to do this?  





        • 1. Re: Set Variable Based on  Value List

          FilterValues ( ValueListItems ( Get ( Filename ) ; "Yourvaluelistnameinquotes" ) ; Yourtable::StateAbb ) will return the value of StateAbb if it is in the value list and null if it is not, but I would not use such value lists myself.

          I'd create a table where each record lists one state and a second field gives the region.

          Then a relationship like this:

          YourTable::StateAbb = States::StateAbb

          can be used to display States::Region on your layout to give the region.

          I'd also use this States table for producing all the region based value lists by setting them up as conditional value lists.

          • 2. Re: Set Variable Based on  Value List

            Thank you Phil.  Does this solution still work each record will contain several different state/region entries (E.g. college, graduate school, home address and each location of work experience)?

            • 3. Re: Set Variable Based on  Value List

              You could still do it if you define separate relationships for each-- to different occurrences of the same Regions table, but I'd put that list of different state/region entries into a related table also. That gives me just one relationship (LocationList to Regions ) and also adds the ability to enter a flexible list of such location records.