Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
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

Re: If statment with SET Value

Thanks,

Its solved with this code

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

View solution in original post

4 Replies

Re: If statment with SET Value

May be try this:

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

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

Partner
Partner

Re: If statment with SET Value

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

Re: If statment with SET Value

Thanks,

Its solved with this code

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

View solution in original post

Not applicable

Re: If statment with SET Value

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