Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Applymap with custom value

how to make the in "Order line"script function "Applymap" picked up [vnt.svoris] from "MAP001", because now write: Field vnt.svoris not found "public".erpoorli

//--------------------item------------------------------

[produktai]:

LOAD ID as [item.ID],

    Name as [produkto.pav],

    Code as [nv.kodas]

;

SQL SELECT *

FROM postgres."public".erpoitm

;

//----------------------MAP001----------------------------

MAP01:

Mapping LOAD ID,

  if(len(TareWeight)>1, TareWeight, 1) as [vnt.svoris]

  ;

SQL SELECT *

FROM postgres."public".erpoitm

;

//----------------------------order line------------------------

[order.line]:

LOAD ID as [OLID],

  OrderID as [order.ID],

    ItemID as [item.ID],

    Qty * APPLYMAP('MAP01', [vnt.svoris]) as [svoris],

    LabelledQty as [at.kiekis]

;

SQL SELECT *

FROM postgres."public".erpoorli

1 Solution

Accepted Solutions
Not applicable
Author

I've found it works if TareWeigh the value is equal to the number (10) then everything works if there is a number (1,5) and then writes that can not find the field.

//----------------------MAP001----------------------------

MAP01:

Mapping LOAD ID,

  TareWeight

  ;

SQL SELECT *

FROM postgres."public".erpoitm

;

//----------------------------order line------------------------

[order.line]:

LOAD ID as [OLID],

  OrderID as [order.ID],

    ItemID as [item.ID],

    Qty as [kiekis.bl],

    Qty * APPLYMAP('MAP01',if(len(TareWeight)>1,TareWeight,1)) as [vnt.svoris],

    LabelledQty as [at.kiekis]

    ;

SQL SELECT *

FROM postgres."public".erpoorli

;

View solution in original post

5 Replies
Not applicable
Author

Hi,

When using the applymap, you provide the first field in the map and get the second ([vnt.svoris] in this case) as the result, so you need to use ID (or maybe OrderID not sure which from your data) instead

order.line]:

LOAD ID as [OLID],

  OrderID as [order.ID],

    ItemID as [item.ID],

    Qty * APPLYMAP('MAP01', ID) as [svoris],

    LabelledQty as [at.kiekis]

;

SQL SELECT *

FROM postgres."public".erpoorli

hope that helps

Joe

maxgro
MVP
MVP

[vnt.svoris]  should be replaced by the name of one  field in postgres."public".erpoorli (ItemID ?)

Gysbert_Wassenaar

The field names in the mapping table are irrelevant to the applymap function. The field name you need to use in the applymap function is a field from, in your case, the postgres.''public''.erpoorli table that contains ID values like those you load in the mapping table.


talk is cheap, supply exceeds demand
Not applicable
Author

have a look at http://community.qlik.com/docs/DOC-5785 too for more info on applymap

Not applicable
Author

I've found it works if TareWeigh the value is equal to the number (10) then everything works if there is a number (1,5) and then writes that can not find the field.

//----------------------MAP001----------------------------

MAP01:

Mapping LOAD ID,

  TareWeight

  ;

SQL SELECT *

FROM postgres."public".erpoitm

;

//----------------------------order line------------------------

[order.line]:

LOAD ID as [OLID],

  OrderID as [order.ID],

    ItemID as [item.ID],

    Qty as [kiekis.bl],

    Qty * APPLYMAP('MAP01',if(len(TareWeight)>1,TareWeight,1)) as [vnt.svoris],

    LabelledQty as [at.kiekis]

    ;

SQL SELECT *

FROM postgres."public".erpoorli

;