Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Value of the Flag as "X" is exists "Y" if not exists!

Hi All,

I have xls which contain field called "ID" and it has following values.

ID

ABC

XYZ

QRS

ASP

Basically I want to load the values which are in the xls. If the above values exists in one of the field in the below load statement then value of that field should be X or else it should be Y and name the field as "Flag". FYI, Below data is getting loaded from QVD.

Load *,

if(ValueExits,'X','Y') as Flag

from data.qvd

May be I guess we need to use the apply map but I am not sure.

Can some one please help me out for this. It is little urgent!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If you want to check for existence of the value in a specific, single field of your qvd load (and not if it occures in any of the fields), you can do it like this:

LOAD DISTINCT

     ID as ValueToCheck

FROM Excel.xls;

LOAD *,

     if(exists(ValueToCheck, ID),'X','Y') as Flag

FROM data.qvd;

where ID is the field you want to compare your values to.

View solution in original post

7 Replies
swuehl
MVP
MVP

If you want to check for existence of the value in a specific, single field of your qvd load (and not if it occures in any of the fields), you can do it like this:

LOAD DISTINCT

     ID as ValueToCheck

FROM Excel.xls;

LOAD *,

     if(exists(ValueToCheck, ID),'X','Y') as Flag

FROM data.qvd;

where ID is the field you want to compare your values to.

View solution in original post

mov
Champion III
Champion III

If you have to check only one field from qvd, it is:

if(exists(ID, Field),'X','Y') as Flag

If there are several fields to check:

if(exists(ID, Field1) or exists(ID, Field2) or exists(ID, Field3) ...,'X','Y') as Flag

stabben23
Master
Master

Hi,

If you have the ID field in the data.qvd you can solve it in two simple ways.

1. where Exists(ID,ID)

2.

Maping:

Mapping Load

ID

'X'

from your ID table.

then use:

Load *,

if(applymap('Maping', ID,'Y')) as Flag

from data.qvd

//Stabben

qlikviewforum
Creator II
Creator II
Author

Thanks all. Everything looks good.Please give me some time. I will check and update you.

qlikviewforum
Creator II
Creator II
Author

Hi All,

Can you please help me out here! It is little urgent!

http://community.qlik.com/thread/100817

swuehl
MVP
MVP

What about all the proposed solutions you already have?

If all these do not work (which I don't believe), can you tell us, what the issue is or how the results differ from your expectation (so you need to post some input data,  the script you used, the output you get, and what you expected instead). It's all urgent, for everybody, something.

qlikviewforum
Creator II
Creator II
Author

Hi Swuehl,

Yes the solution did worked. I should have marked as correct answer which I didn't do. Sorry!