Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vardhancse
Specialist III
Specialist III

Lookup

Hi

Have a requirement is that:

need to fill field_2 data based on field_1.

using lookup function.

6 Replies
MK_QSL
MVP
MVP

Please elaborate little more and if possible, provide some sample data.

vardhancse
Specialist III
Specialist III
Author

Have 2 tables:

table_1:

Field_2

Field_3

table_2:

Field_1

Field_2

Field_3

in table_2 if field_3 value is blank then based on Field_2 from table_2 need to lookup in Field_2 from table_1

Not applicable

Hi,

Use an IF and ApplyMap, something like this:

table_1:

Mapping

Load

     Field_2

     Field_3

from table_1.qvd;

table_2:

Load

     Field_1

     Field_2

     If( Len(Trim(Field_3))=0, Applymap('table_1',Field_2) as Field_3

From table_2.qvd;

Best regards.

fkeuroglian
Partner - Master
Partner - Master

See this article

there is a part explain look up function

good luck

Fernando

alexandros17
Partner - Champion III
Partner - Champion III

Here is my example

AA:

LOAD * Inline [

Nome, Eta

Ale, 49

Ange, 47

tato, 10

Dada, 12

];

BB:

LOAD * Inline [

Eta, Fascia

10, Bimbo

12, young

47, Adult

49, Old

];

CC:

NoConcatenate

LOAD lookup('Fascia', 'Eta', Eta, 'BB') as xxx, * resident AA;

DROP Tables AA, BB;

MK_QSL
MVP
MVP

T1:

Load * Inline

[

  Field2, Field3

  A, 100

  B, 120

  C, 200

  D, 180

];

T2:

Load

  Field1,

  Field2,

  IF(IsNull(Field3) or LEN(TRIM(Field3))=0,Lookup('Field3','Field2',Field2,'T1'),Field3) as Field3

Inline

[

  Field1, Field2, Field3

  F1, A, 1200

  F2, B, 1400

  F3, C,

  F4, D,

  F5, A,

];

Drop Table T1;