Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
remo0017
Contributor II
Contributor II

If Condition issue on Qlikview

I have the following situation here


Field1

Owns CC

Using DC



Now I want to derive two different fields [Owns_Creditcard &  Uses_Debitcard]  based on the data inside Field1


if (Field1='Owns CC',Field1) as Owns_Creditcard

if (Field1='Using DC',Field1) as Uses_Debitcard



If i use the above logic i get data like this



Owns_creditcard      Users_Debitcard

YES                               -

-                                    YES


But I always want to see only this


Owns_creditcard           Users_Debitcard

YES                               YES


Could you please help me to correct the logic

6 Replies
devarasu07
Master II
Master II

Hi,

try like this, anyone one method should work.


load *,

if(Field1='Owns CC','Owns_Creditcard', if(Field1='Using DC','Owns_Creditcard',Field1)) as Type,

if(WildMatch(Field1,'*Owns*','*Using*'),'Owns_Creditcard','Owns_Creditcard') as Type1;

LOAD * INLINE [

  Field1,Amount

    "Owns CC",1500

    "Using DC",2500

];

Capture.JPG


Anonymous
Not applicable

If you have a record like this:

Name Field1       Owns_Creditcard  Users_debitcard

Peter OwnsCC   Yes                                  *

What would you like to see as the * ?

If you have that Users_debitcard as a column it must have a value, if not, by default qlikview will put a null value there (that is what is happening to you)

remo0017
Contributor II
Contributor II
Author

This only shows Owns_Creditcard field

But I need to see or derive two fields based on this Field1's data

Owns_CC      as Owns_Creditcard

Uses_DC       as Uses_Debitcard

In the above example I only see Owns_Creditcard field alone.

Thanks very much for your prompt help and its much appreciated

remo0017
Contributor II
Contributor II
Author

There is no field called Uses_debitcard


I need to derive the column called Uses_debitcard when Field1 is "Using DC".


But Field1 has data like this

Owns CC

Using DC



For the value * I need to see "YES" too


Much appreciated for your help!




Anonymous
Not applicable

I think you didn't get my example. If a person uses debitcard, what do you want to see on the field Owns_Creditcard?

qlik4asif
Creator III
Creator III

Load Field1,

     ' Owns_Creditcard' as Usercard

from XXXXXXXX

where Wildmatch(Field,'*Owns CC*');


Concatenate

Load Field1,

     ' Uses_Debitcard' as Usercard

from XXXXXXXXX

where Wildmatch(Field,'*Using DC*');


Now create a table with Field1,Usercard


here you can see as you want

basically it works like flag here