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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data mapping condition in script

Lets say I have two tables looks like below

Table 1

IDProductAmount
1A100
1B200

Table2

IDProductAmount
1A300
1C250

Now I want to create the Final table with below condition

If ID & Product from Table1 exist in Table2 , then Take the Amount wherever it is greater, in this case it will pick from table2.

Also take ID & Product from Table2 which not there in Table1.

Final Output

  

IDProductAmount
1A300
1B200
1C250
30 Replies
Not applicable
Author

This is also slow down the reload task and consuming memory

Not applicable
Author

still the same issue

sunny_talwar

Do you know which part (concatenation or the resident) is slowing down the reloading? and have you made comparison as to which method has done the best so far. May be we can choose one of the methods (most likely the best performing one) and look for ways to optimize it further

Not applicable
Author

issue is ate resident load

sunny_talwar

Does it take substantially lesser time if you remove the where clause?

FinalTable:

NoConcatenate

LOAD ID,

  Product,

  Amount

Resident Table

Where ID&Product <> Previous(ID&Product)

Order By ID, Product, Amount desc;

DROP Table Table;


Kushal_Chawda

Give it a try


Map:

mapping LOAD

    Autonumber(ID&Product) as Key,

    Amount

FROM Table2;

Data1:

LOAD ID,

    Product,

    Autonumber(ID&Product) as Key,

    rangemax(applymap('Map',Autonumber(ID&Product)),Amount) as Amount

FROM Table1;

concatenate(Data1)

LOAD *

where not exists(Key);

LOAD ID,

    Product,

    Amount,

    Autonumber(ID&Product) as Key

FROM Table2;

Drop Field Key;

Not applicable
Author

Yes without where it works good and even better without order by

Not applicable
Author

swuehl‌ can you suggest something?

Not applicable
Author

@stalwar1  any update.

Not applicable
Author

This looks ok