cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jawaugh
Level 2

How to select only the variable that has the value1

Hello everyone,

I'm new to this forum and this is my first post.

I'm somewhat struggling finding out a way to find out the the variables with the value 1. Here is the scenario, I've have an action n the pre-install section where I prompt the user the to select the business types out of 5 given types where the user can select multiple types. Say if I want to select the business types that are numbered 2&4, I'll type in 2,4 after the prompt, which will assign the variable's 2 & 4 with the value 1 and rest of the variables will have zero as the value.

Here is the output text to console in the pre-install section that I have.

BUSINESSTYPE=$BUSINESSTYPE$
BUSINESSTYPE_1=$BUSINESSTYPE_BOOLEAN_1$
BUSINESSTYPE_2=$BUSINESSTYPE_BOOLEAN_2$
BUSINESSTYPE_3=$BUSINESSTYPE_BOOLEAN_3$
BUSINESSTYPE_4=$BUSINESSTYPE_BOOLEAN_4$
BUSINESSTYPE_5=$BUSINESSTYPE_BOOLEAN_5$

With this , the value I get on the screen is as below.

ENTER A COMMA-SEPARATED LIST OF NUMBERS REPRESENTING THE DESIRED CHOICES, OR
PRESS TO ACCEPT THE DEFAULT: 2,4

BUSINESSTYPE="","BBBBBBBB","","DDDDDDDD",""
BUSINESSTYPE_1=0
BUSINESSTYPE_2=1
BUSINESSTYPE_3=0
BUSINESSTYPE_4=1
BUSINESSTYPE_5=0

What I'm trying to achieve here is, pick only the variables that has 1 as the value and pass it to another variable that can be used in the post install section to update a property file. I can also use the variables with the value 1 in the post install section without passing it to another variable whichever is feasible.

Thanks in advance.
Labels (1)
0 Kudos
1 Reply
RamyaVenkatesh
Level 7

You can try writing a Custom Code to do this.

There is also a Compare InstallAnywhere variable numerically rule where you can perform an action depending on the IA variable value, but not sure if it suits your scenario.
0 Kudos