Announcements
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
cancel
Showing results for
Did you mean:
Creator II

## Join and update tables in QlikSense

Hi,

A:

id, field1, field2

1,0,0

2,0,0

3,0,0

4,0,0

5,1,0

];

B:

id, field1, field2

1,1,0

2,1,1

3,0,1

6,1,0

];

Question: Update table A by checking if the `id` from A is present in B or not(similar to left join). If present in B, update the field1 and field2 values of that id in A by picking its corresponding values from table B

Required Output is (modify table A as:)

id, field1, field2

1,1,0

2,1,1

3,0,1

4,0,0

5,1,0

I appreciate any help with this.

Thanks,

Amuktha

1 Solution

Accepted Solutions
Master III

Hi Amuktha,

may be this

B:
id, field1, field2
1,1,0
2,1,1
3,0,1
6,1,0]
;
A:
NoConcatenate
If(Exists(id),Lookup('field2','id',id,'B'),field2) as field2
inline [
id, field1, field2
1,0,0
2,0,0
3,0,0
4,0,0
5,1,0]
;
Drop Table B;

Regards,

Antonio

4 Replies
Master III

Hi Amuktha,

may be this

B:
id, field1, field2
1,1,0
2,1,1
3,0,1
6,1,0]
;
A:
NoConcatenate
If(Exists(id),Lookup('field2','id',id,'B'),field2) as field2
inline [
id, field1, field2
1,0,0
2,0,0
3,0,0
4,0,0
5,1,0]
;
Drop Table B;

Regards,

Antonio

Creator II
Author

Hi Antonio,

Thanks for looking into this. Following script returns all field1 and field2 values as is from A and not updating them.

B:

Load id, field 1 as field1, field 2  as field2

FROM [.....xlsx]

(ooxml, embedded labels, table is Sheet1);

A:

If(Exists(id),Lookup('field2','id',id,'B'),field2) as field2

from [lib://.....qvd](qvd);

May I know what am I doing wrong. I appreciate your help.

Thanks,

Amuktha

Master III

See Attachment

Creator II
Author

There was some problem with my data set. The solution works perfect.