Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create flag

Hello Viewers,

There are 2 tables

In 1st table contains 10 records(emp id)

Now I have loaded 2nd table contains 25 records(emp id)

Now I want to create a flag in 2nd table with

Exists(If already exists in 1st table) and

new(If it is new record)

How to accomplish this ????

Please help!!!

1 Solution

Accepted Solutions
avinashelite

Try like this

Table1:

LOAD

EMP_ID,

...

Table2:

LOAD

EMP_ID,

If(Exists(EMP_ID)='-1','Yes','No') as Flag,

...



View solution in original post

11 Replies
sunny_talwar

May be like this:

LOAD [emp id],

          [emp id] as temp_emp_id

          ....

FROM Table1;

LOAD [emp id],

          If(Exists(temp_emp_id, [emp id]), 'Existing', 'New') as Flag,

          ....

FROM Table2;

avinashelite

Try like this

Table1:

LOAD

EMP_ID,

...

Table2:

LOAD

EMP_ID,

If(Exists(EMP_ID)='-1','Yes','No') as Flag,

...



sdmech81
Specialist
Specialist

LOAD *,

          emp_id as Check_Emp_Id

        

FROM Table1;

LOAD  *,
          emp_id ,

          If(Exists(emp_id ,Check_Emp_Id), 'Exists', 'New') as Flag,

FROM Table2;

Check fr emp_id frm table 2's existnace in Table one's Check_Emp_Id

Try

sunny_talwar

Sachin I think the order within Exists is nor right.... I think it should be

If(Exists(Check_Emp_Id, emp_id), 'Exists', 'New') as Flag,

Chanty4u
MVP
MVP

try this

:

LOAD * INLINE [

    emp, name

    1, fsfg

    2, dds

    3, aaas

    4, aa

    5, gdg

];

b:

LOAD * INLINE [

    emp, name

    1, fsfg

    2, dds

    3, aaas

    4, aa

    5, gdg

    6,gg

    7,hh

    8,rr

];

Left Join (a) 

    LOAD emp, 

        Sign(Count(emp)-1) as MultNameFlag 

    Resident a 

    Group By emp;

flg.PNG

Not applicable
Author

Thank you guys for your quick response.

Both are helpful.

But I really don't understand

Exists(emp_id)='-1'

Can you please elaborate this(what describes '-1')??

sdmech81
Specialist
Specialist

HI Sunny I think its correct only:

If(Exists(emp_id ,Check_Emp_Id), 'Exists', 'New') as Flag,

By saying this I m checking emp_id frm table to present in Check_Emp_Id of table 1.

@ Babi.... plss verify once..

Sachin

avinashelite

Exists() function return an integer value so if its true then it returns -1 else 0

avinashelite

Sachin, Order should be First loaded column name first and then the second loaded column so it should be

Exists(First table loaded column name  ,Second table loaded column name)