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

How to write if condition to get all values in the script...

Hi Everyone,

I want to write an if condition as below:

For e.g

Fieldname

1

2

3

4

5

if(Fieldname = '1','A',

if(Fieldname <> '1','B',

if(Fieldname = 'ALL','C',

)

ALL is whole value in the field.

Please help me with this issue...

Regards,

Kavita

1 Solution

Accepted Solutions
sunny_talwar

May be create a link table:

LinkTable:

LOAD DISTINCT FieldName,

          'A' as Flag

Resident Fact

Where Fieldname = 1;

Concatenate (LinkTable)

LOAD DISTINCT FieldName,

          'B' as Flag

Resident Fact

Where Fieldname <> 1;

Concatenate (LinkTable)

LOAD DISTINCT FieldName,

          'C' as Flag

Resident Fact;

View solution in original post

4 Replies
sunny_talwar

May be create a link table:

LinkTable:

LOAD DISTINCT FieldName,

          'A' as Flag

Resident Fact

Where Fieldname = 1;

Concatenate (LinkTable)

LOAD DISTINCT FieldName,

          'B' as Flag

Resident Fact

Where Fieldname <> 1;

Concatenate (LinkTable)

LOAD DISTINCT FieldName,

          'C' as Flag

Resident Fact;

kavita25
Partner - Specialist
Partner - Specialist
Author

Thanks...

But I don't want to do concatenation..is there any simple solution..like in if condition itself..?

sunny_talwar

AFAIK, if won't be able to handle it. Why are you hesitant to use concatenation here? your data model should not be impacted too much because you won't expand your Fact table, it will only be a link table.

kavita25
Partner - Specialist
Partner - Specialist
Author

Okay..i tried...Thanks for the solution..