install4j - Passing installer variables from Installation type screen to condition expression -


i have added installation type screen install4j installer. in accrodance selected installation type files downloaded , unzipped. these actions grouped 4 groups , reside under "installation" control execution flow use condition expression on each group depending on selected type of installation

here code:

if ((string)context.getvariable("sys.installationtypeid") == "424")     return true; return false; 

the problem returns false (not executed) though select installation type.

does know why happens? maybe

(string)context.getvariable("sys.installationtypeid")  

is not string? maybe array? how write condition properly?

thanks!


solutuon found!

i've found 2 workarounds problem

  1. use numeric values installationtypeid , convert integer:

if (integer.parseint(context.getvariable("sys.installationtypeid").tostring()) == 424) return true; return false;

  1. use equals() method inside if statement. allows use custom ids.

if (((string)context.getvariable("sys.installationtypeid")).equals("424")) return true; return false;

you cannot compare strings equality operator, have use equals. equality operator checks if both sides refer same object, not case dynamically created strings.

i recommend set condition expression to

context.getvariable("sys.installationtypeid").equals("424") 

you don't need if statement , returns, expression evaluates boolean.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -