Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If Statement variable not working with equals sign in Edit Script

Hi, beginner here,

let computer = ComputerName();

If $(computer) = $(computer) then

     Set vDrive = a;

else

     Set vDrive = b;

end if

I am using this " If $(computer) = $(computer) ", because I know it will equal, expecting the IF statement to go to Set vDrive = a; 

but the code keeps going to  Set vDrive = b; not sure what is going on, any help is extremely appreciated.

1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like this

let computer = ComputerName();

If '$(computer)' = '$(computer)' then

     Set vDrive = a;

else

     Set vDrive = b;

end if

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
Jason_Michaelides
Partner - Master II
Partner - Master II

Try If $(computer) = '$(computer)' - note the apostrophes added.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If you use a $ expansion, you will need to put this in quotes. But in this case, you don't need a $ expansion, for example:

If vComputer = vComputer2 Then

....

End If

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MayilVahanan

Hi

Try like this

let computer = ComputerName();

If '$(computer)' = '$(computer)' then

     Set vDrive = a;

else

     Set vDrive = b;

end if

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.