Please enable JavaScript to view this site.

Vensim Help

The CONDITIONAL control allows the conditional inclusion of different commands and controls within a Venapp screen.  The control uses the format

CONDITIONAL,"Test Var=1",,

The final two commas are very important.  The expression in quotes is any valid model variable comparison to a number or other model variable.  

If the statement contained in the CONDITIONAL control is false, each control following the CONDITIONAL control will be ignored.  This will continue until another CONDITIONAL control is encountered.  The second CONDITIONAL control may specify a new condition, or it may be blank to indicate the termination of the conditional test.  This should be clear in the following example.

:SCREEN CONDTEST

CONDITIONAL,"product is active[p1]=1",,

SLIDEVAR,"Price[p1]",10,10,15,6,H,%L[0|60|1]

CONDITIONAL,"product is active[p2]=1",,

SLIDEVAR,"Price[p2]",10,20,15,6,H,%L[0|60|1]

CONDITIONAL,"product is active[p3]=1",,

SLIDEVAR,"Price[p3]",10,30,15,6,H,%L[0|60|1]

CONDITIONAL,"",,

! . . . other stuff

CONDITIONAL,"product is active[p1]=0",,

BUTTON,"Launch 1",10,10,15,6,,,SIMULATE>SETVAL|product is active[p1]=1,CONDTEST

CONDITIONAL,"product is active[p2]=0",,

BUTTON,"Launch 2",10,20,15,6,,,SIMULATE>SETVAL|product is active[p2]=1,CONDTEST

CONDITIONAL,"product is active[p3]=0",,

BUTTON,"Launch 3",10,30,15,6,,,SIMULATE>SETVAL|product is active[p3]=1,CONDTEST

CONDITIONAL,"",,

! . . .

This screen would either contain a launch button, or a slider to set price, for each product.