Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

lookup function

can anyone explain lookup function

thanks in advance,

1 Solution

Accepted Solutions
Not applicable

Re: lookup function

Hi,

See the doc I published on LOAD : http://community.qlik.com/docs/DOC-5698

There is a section on lookup and Applymap functions.

Fabrice

3 Replies
Not applicable

Re: lookup function

Hi,

See the doc I published on LOAD : http://community.qlik.com/docs/DOC-5698

There is a section on lookup and Applymap functions.

Fabrice

Re: lookup function

See this document: Joins and Lookups


talk is cheap, supply exceeds demand

Re: lookup function

You can search in QlikView Help File or QlikView Reference Manual for lookup function...


lookup(fieldname, matchfieldname, matchfieldvalue [, tablename])

Returns the value of fieldname corresponding to the first occurrence of the value matchfieldvalue in the field matchfieldname.

Fieldname, matchfieldname and tablename must be given as strings (e.g. quoted literals).

The search order is load order unless the table is the result of complex operations such as joins, in which case the order is not well defined.

Both fieldname and matchfieldname must be fields in the same table, specified by tablename. If tablename is omitted the current table is assumed.

If no match is found, null is returned.

Consider that you have Customer Table having customer information and Sales Table having customer name only.

You want to lookup customer id or customer country in sales table.

===============================================

Customer:

Load Text(ID) as ID, Name, Country Inline

[

  ID, Name, Country

  001, A, Germany

  002, B, Italy

  003, C, France

  004, D, Poland

  005, F, Spain

];

Sale:

Load *, Lookup('Country','Name', CustomerName, 'Customer') as Country Inline

[

  CustomerName, Sale

  A, 100

  B, 200

  C, 300

  D, 260

  E, 140

];

Drop Table Customer;

=============================

There are another function.... ApplyMap which is used and more fast than lookup but mapping table should have only two columns. One for reference and second as an end result.

Instead of ApplyMap and Lookup, you can join the table also, but sometimes for big database your application get slower and response time increased, so above two functions are handy.

Hope this help....

Community Browser