Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Update field of a resident table depending on values of another table

Hi,

Due to my inexperience I don't know how to solve this apparently simple problem.

I've loaded a table with a id, some data and a flag 0/1, with default value 0


Employees1:

LOAD id,

  ...

  0 AS flag

FROM [..];

idflag
A0
B0
C0
D0

Also, I've another table 'Employees2' with the same ids as 'Employees1'

Employees2:

LOAD id,

  ...

FROM [..];

id
A
C


The problem is that I need to update the field 'flag' of 'Employees1' in order to set a value of 1 for the records whose ids are present in 'Employees2'. In the example, this is the final outcome desired:

idflag
A1
B0
C1
D0

I'm considering looping 'Employees1', checking if each id exists in 'Employees2' and updating the flag if it's the case, but I don't konw if this is possible (in special the update part) or if this is the correct approach.

Thanks in advance,

1 Solution

Accepted Solutions
ahaahaaha
Honored Contributor

Re: Update field of a resident table depending on values of another table

Hi,

May be like this?

Table1:

LOAD*Inline

[id

A

B

C

D

];

Left Join

Table2:

LOAD*Inline

[id, Flag

A, 1

C, 1

];

In table NULL value change to zero.

Result

1.jpg

2 Replies
ahaahaaha
Honored Contributor

Re: Update field of a resident table depending on values of another table

Hi,

May be like this?

Table1:

LOAD*Inline

[id

A

B

C

D

];

Left Join

Table2:

LOAD*Inline

[id, Flag

A, 1

C, 1

];

In table NULL value change to zero.

Result

1.jpg

Not applicable

Re: Update field of a resident table depending on values of another table

Yes, it's correct, it can be done easily with a left join. Tanks!

Community Browser