Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statment with SET Value

Hi,

I tried to create a if statement that separates customers and employees based on ActorEmployee_ID

so if someone has a ActorEmployee_ID that is one of the values in vSupport then its a Employee in Type. Else its a Customer my if statement does not compile I get a error. Any ideas, should I use a mapping table instead?

SET vSupport=('523','2203','1009','2185','2405','2186','1801','509','2202');

If(ActorEmployee_ID=$(vSupport),Employee,'Customer') as Type,

1 Solution

Accepted Solutions
Not applicable
Author

Thanks,

Its solved with this code

if(index('$(vSupport)',ActorEmployee_ID)>0,'Employee','Customer') as Type

View solution in original post

4 Replies
sunny_talwar

May be try this:

SET vSupport='523','2203','1009','2185','2405','2186','1801','509','2202';

If(Match(ActorEmployee_ID, $(vSupport), Employee, 'Customer') as Type,

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I would try using FOR EACH loop on vSupport. Which will run through each value in vSupport , it will identify whichever value to be classify as Employee or Customer. Store each value for Employee or Customer in a Temp Tbale and use Peek function to pick them back and use it wherever you wish.


FOR EACH vSupport IN $(vSupport)

     IF vSupport = whatever employee value is then

          EmpTable:

LOAD

$(vSupport)               AS EmpVlaue

AUTOGENERATE 1;


Something like that


Not applicable
Author

Thanks,

Its solved with this code

if(index('$(vSupport)',ActorEmployee_ID)>0,'Employee','Customer') as Type

Not applicable
Author

Hi Sunny I got the solutions posted down, I could not execute your script though but tour idea with the match helped