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.
vardhancse
Valued Contributor II

Lookup

Hi

Have a requirement is that:

need to fill field_2 data based on field_1.

using lookup function.

6 Replies
MVP
MVP

Re: Lookup

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

vardhancse
Valued Contributor II

Re: Lookup

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

Re: Lookup

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
Honored Contributor

Re: Re: Lookup

See this article

there is a part explain look up function

good luck

Fernando

Re: Lookup

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;

MVP
MVP

Re: Lookup

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;

Community Browser