Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Not applicable

flags

how to use flags in qlikview?

1 Solution

Accepted Solutions
Not applicable

Re: flags

DearYojas,

Yes, You heard right using flags in concatenation can give youdifferent results then joins (outer or any other).

and to get to the reason, you need to understand howconcatenation and outer join works differently.

The basic use of Concatenation is to combine same data comingfrom different sources.

The basic use of Joins is to combine different data coming fromdifferent sources based on some common link(s).

From my experinces, Flags are used mostly when we want to addidentifiers/differentiators to our data members explicitly.

Flags can be used while concatenating as well as may also beused on a single table data

for example

t1:

Load

     A,

     'table1' as table

autonumber 1;

concatenate (t1)


Load

     A,

     'table2' as table

autonumber 1;

That way we have a flag/identifier to help us in figuring outwhat data is coming from which table.

On a Single table

t1:

Load

     A,

     experience,

     if(experience<1, probation,permanent) as flag

from xyz.qvd(qvd);

So, flags are mostly data created by us for our use.

Now, to see how you will get different results with Flags inConcatenation/Outer join, please find the attached excel file.

Cocatenation and Joins are to entirely different operations,still in some cases they may yield you same results but that should not betaken as they are same operations.

So in your join operations flag will work as a key for join butin concatenation it will not.

Hope, this helps you!! Best of luck.

If I can be of any help then please let me know. 

View solution in original post

10 Replies
rohit214
Contributor III

flags

Hi

Flag is nothing but the  like a identifire , it is use to identify which value comes from which table or data source

for example

suppose you have 2 execl files where all the fields having same name and you want to

concatenate both tables but you want to identify which data comes from which execl file.

so your script look like

LOAD

'TABLE1' as Flag,

field1,

field2,

.

.

.

.

.from

xyz.xls;

concatenate

LOAD

'TABLE2'   as Flag,

field1,

field2,.

.

.

.

.

from abc.xls;

thanks& regard

rohit

Not applicable

flags

But what if i joined these two tables using outer join and then i want to analyze data using flag....can u give me ny example on it....

Not applicable

flags

Hi Yojas,If you join above two tables using a key ,also Flag field will be common between them,tat will create synthetic key,so flag can be used logically when we want to have data from same table diferrentiated based on Flag

Not applicable

flags

Hi Yojas,

Can you give me a sample data with scenario which will have better picture so that I can give you solution.

But as per my understanding, IOf you are having two tables then definitely there will be a common key between two table and gain if you do outer join with falg then there will be a synthetic key.

So concatenation is the option to do so.

tab1:

load key,

a,

b,

'1' as Flag

concatenate

tab2:

load key,

c,

d,

'2' as Flag

Not applicable

flags

m havin same table structure as u mentioned but instead of concatenate i used outer join. then will it work?

Not applicable

flags

Hi Yojas,

Ofcourse it will work If you do outer join ,then it will form a single table with the fields Key, a,b,c,d, Flag.

You can try out by creating sample data in excel.

Can you tell me exactly what you want to achieve?

Regards,

Kushal chawda

rohit214
Contributor III

flags

Hi

what ever join or concatenation or may be same field or diffrent field or any thing else it does't matter

it won't effect

thanks & Regads

rohit

Not applicable

flags

but i heard it from some1 tat if i used outer join den i cn not use it because the primary key and tat Flag field these 2 field become common between them..... and it shows some wrong result...........

Not applicable

Re: flags

DearYojas,

Yes, You heard right using flags in concatenation can give youdifferent results then joins (outer or any other).

and to get to the reason, you need to understand howconcatenation and outer join works differently.

The basic use of Concatenation is to combine same data comingfrom different sources.

The basic use of Joins is to combine different data coming fromdifferent sources based on some common link(s).

From my experinces, Flags are used mostly when we want to addidentifiers/differentiators to our data members explicitly.

Flags can be used while concatenating as well as may also beused on a single table data

for example

t1:

Load

     A,

     'table1' as table

autonumber 1;

concatenate (t1)


Load

     A,

     'table2' as table

autonumber 1;

That way we have a flag/identifier to help us in figuring outwhat data is coming from which table.

On a Single table

t1:

Load

     A,

     experience,

     if(experience<1, probation,permanent) as flag

from xyz.qvd(qvd);

So, flags are mostly data created by us for our use.

Now, to see how you will get different results with Flags inConcatenation/Outer join, please find the attached excel file.

Cocatenation and Joins are to entirely different operations,still in some cases they may yield you same results but that should not betaken as they are same operations.

So in your join operations flag will work as a key for join butin concatenation it will not.

Hope, this helps you!! Best of luck.

If I can be of any help then please let me know. 

View solution in original post