Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
caccio88
Creator II
Creator II

Create a new field in a table if exist values in another table

Ho everyone,

what i would like to do is to create a new field in the first table if exist values in another table.

Table1:

LOAD * INLINE [

    A

    1

    2

    3

    4

    5

    6

    7

    8

];

Table2:

LOAD * INLINE [

    A

    2

    3

    4

    10

    11

    12

];

What I'd like to do is to create a "B" field in the Table1 where the values are:

- "OK" if the value in the field A of Table1 exist in the field A of Table2;

- "KO" if the value in the field A of Table1 does not exist in the field A of Table2.

Is that clear enough?

The field "B" in the "New" Table1 should be:

B

KO

OK

OK

OK

KO

KO

KO

Here attached my qvw example.

Thank u all.

Filiberto

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_197225_Pic1.JPG

Table2:

LOAD * INLINE [

    A

    2

    3

    4

    10

    11

    12

];

Table1:

LOAD *,

    If(IsNull(Lookup('A','A',A,'Table2')),'KO','OK') as B

INLINE [

    A

    1

    2

    3

    4

    5

    6

    7

    8

];

hope this helps

regards

Marco

View solution in original post

2 Replies
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_197225_Pic1.JPG

Table2:

LOAD * INLINE [

    A

    2

    3

    4

    10

    11

    12

];

Table1:

LOAD *,

    If(IsNull(Lookup('A','A',A,'Table2')),'KO','OK') as B

INLINE [

    A

    1

    2

    3

    4

    5

    6

    7

    8

];

hope this helps

regards

Marco

sunny_talwar

Another solution could be using Mapping Load:

Table2:

Mapping

LOAD * INLINE [

    A, B

    2, OK

    3, OK

    4, OK

    10, OK

    11, OK

    12, OK

];

Table1:

LOAD A,

  ApplyMap('Table2', A, 'KO') as B;

LOAD * INLINE [

    A

    1

    2

    3

    4

    5

    6

    7

    8

];


Capture.PNG