Home      Ask a Question      My Stuff      Help   
  
Scripting - Translating Mulitple Variables Entered at a Clock Prompt
Using this script allows one to take 2 lists of predefined entries and translate them in a simpler format then previously.

For example the old way would be to create a separate script for each different entry like below:

if (y <> "")
{
if (y = "1"){y = "Department 1";}
if (y = "2"){y = "Department 2";}
if (y = "3"){y = "Department 3";}
{
else{y = "None of the Above";}

Using the above example we can script them as two sets of lists instead of scripting for each set. An example of the above in this alternate format is below:

y =
translate(y,"1|2|3|999","Department 1|Department 2|Department 3|None of the Above");

If you have all variables in pairs and they enter in something not part of the first list it will default to the last variable or in our example "None of the Above".

One thing to watch out for is that if the variables do not have a corresponding pair (i.e. 1 = Department 1, 2 = Department 2 etc.) or if they enter in something other than the first list (1,2,or 3) like for example "4" it will default to the last PAIRED variable in your list.

So if we use our example modified to remove the "999" and keeping "None of the Above":

y =
translate(y,"1|2|3|","Department 1|Department 2|Department 3|None of the Above");

If they enter something other than 1,2,3 from our first list say 4 again it will default to the last PAIRED or "Department 3".

ID
474
Category
Training
  FAQ's
Date Created
3/18/2010 2:47:01 PM
Date Updated
3/19/2010 1:23:41 PM
Back to Search Results