Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Environment Variable

Hi All,

I want to create a environment variable.

Actually we are doing development in test server then we move to prod sever.

Application has path like [\\100.10.0.10\Qlikview\Data\filename.xls] --------- in test server

Whenever I move to prod it will get failed due to path error, prod server (IP) name is different, path should be like this [\\1001.11.0.11\Qlikview\Data\filename.xls]'----- in prod server

So I created environment variable like as

LET vServerName = ComputerName();
IF ComputerName = 'Devservername' then
SET vEnv = '\\100.10.0.10';
else
SET vEnv = '\\1001.11.0.11';
ENDIF

However its not working, it execute always else condition (actually vEnv should contain \\100.10.0.10 but it contain \\1001.11.0.11.

There is any mistake in the code.

Could you please assist on this.

Thanks,

Nihhal.

1 Solution

Accepted Solutions
sunny_talwar

May be put the variable within single quotes

LET vServerName = ComputerName();

IF '$(vServerName)' = 'Devservername' then

SET vEnv = '\\100.10.0.10';

else

SET vEnv = '\\1001.11.0.11';

ENDIF

View solution in original post

10 Replies
sunny_talwar

You meant this?

LET vServerName = ComputerName();
IF $(vServerName) = 'Devservername' then
SET vEnv = '\\100.10.0.10';
else
SET vEnv = '\\1001.11.0.11';
ENDIF

avinashelite

try like this

IF ComputerName() = 'Devservername' then

nihhalmca
Specialist II
Specialist II
Author

Yes Sunny, even not working.

sunny_talwar

May be put the variable within single quotes

LET vServerName = ComputerName();

IF '$(vServerName)' = 'Devservername' then

SET vEnv = '\\100.10.0.10';

else

SET vEnv = '\\1001.11.0.11';

ENDIF

nihhalmca
Specialist II
Specialist II
Author

Thanks sunny.

this one also helpful.

LET vServerName = ComputerName();

IF ComuterName() = '$(vServerName)' then

SET vEnv = '\\100.10.0.10';

else

SET vEnv = '\\1001.11.0.11';

ENDIF

sunny_talwar

This IF statement will always be true my friend Because your variable is also ComputerName()... Did you mean this

LET vServerName = 'Devservername';

IF ComuterName() = '$(vServerName)' then

SET vEnv = '\\100.10.0.10';

else

SET vEnv = '\\1001.11.0.11';

ENDIF

nihhalmca
Specialist II
Specialist II
Author

Just I missed () sunnay as Avinash said.

working this without vServername variable

//LET vServerName = ComputerName(); -- not required
IF ComputerName() = 'Devservername' then
SET vEnv = '\\100.10.0.10';
else
SET vEnv = '\\1001.11.0.11';
ENDIF

sunny_talwar

Hahahaha yes, I guess I thought that you wanted to do this in two steps where you first assign the value of ComputerName() to a variable and then use that... but yes, it can be done in a single step also....

nihhalmca
Specialist II
Specialist II
Author

Hi Sunny,

After all my practice.

If I go without storing servername in a variable (single step), it works wired (first time it works fine after that it works as unexpected.

Best practice is storing server name into variable (two steps).

LET vServerName = ComputerName();
IF ComputerName() = 'servername'