Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

IF Condition - Like Operator

Hi All,

Need your help.

I want to implement logic at back end. for example. Field name is Gaap/Non-Gaap it has values like

Gaap/Non-Gaap

Gaapxyz

Gaap 123

.

.

up to 100 values

Non-Gaapxyz

Non-Gaap 123

.

.

Up to 150 values

xyz

123

And my requirement is i want to make these many values as 4 values

value 1: where ever 'Gaap' text is there consider as Gaap

value 2: where ever 'Non-Gaap' text is there consider as Non-Gaap

value 3: xyz

value 4: 123

Result should be

Gaap/Non-Gaap

Gaap

Non-Gaap

xyz

123

For all i know, have to use LIKE operator (WildMatch) in IF condition.

Regards,

Nihhal.

1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like this

Load *, Pick(WildMatch(Gaaps, 'xyz', '123', '*Non-Gaap*', '*Gaap*', '*'), 'xyz', '123', 'Non-Gaap', 'Gaap', Gaaps) AS NewGaaps;

Load * Inline

[

Gaaps

Non-Gaapxyz

Non-Gaap 123

Gaapxyz

Gaap 123

xyz

123

sdfs

];

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

7 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi Nihhal,

Try like this

LOAD

*,

If(Pick(WildMatch(FieldName, '*xyz*', '*123*', '*Non-Gaap*', '*Gaap*', '*'), 'xyz', '123', 'Non-Gaap', 'Gaap', FieldName) AS NewFieldName

FROM DataSource;


Regards,

Jagan.



MayilVahanan

Hi

Try like this

Load *, Pick(WildMatch(Gaaps, 'xyz', '123', '*Non-Gaap*', '*Gaap*', '*'), 'xyz', '123', 'Non-Gaap', 'Gaap', Gaaps) AS NewGaaps;

Load * Inline

[

Gaaps

Non-Gaapxyz

Non-Gaap 123

Gaapxyz

Gaap 123

xyz

123

sdfs

];

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

Thanks for reply ramasamy.

It is working fine, however 'Preceding load is not require here.

Thank you.

Nihhal.

nihhalmca
Specialist II
Specialist II
Author

Thanks for reply Jagan.

It is not working fine, due to IF condition.

Thank you.

Nihhal.

MayilVahanan

Hi Nihal,

For understanding, used like that.

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

Yes by mistake I typed If in the expression, otherwise it works.

Regards,

Jagan.

nihhalmca
Specialist II
Specialist II
Author

Ok ramasamy.