Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
annagustafsson
Partner - Contributor
Partner - Contributor

Apply Map and for loop

Hi,

I make a table like this; 

InvoiceBatch_tmp:
LOAD * INLINE [
ID, text
1, Ny
2, Ongoing
... to 31 rows...

Then, I use ApplyMap function for each ID to match it against the ID with my  "real" table. 
Is it possible to make a for loop to automatically map these together? So I do not have to do 31 mappings for each ID. 

// Anna 

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should not require a loop at all. Can you a bit more of your script so we can understand what you are trying to accomplish?

-Rob

annagustafsson
Partner - Contributor
Partner - Contributor
Author

Hi Rob,

Thanks for your reply.

I'll try to explain a little better.

In my qvd-file I have statusId which contains a number 1-31. Each number corresponds to, for example, 'reviewed', 'announced', 'invoiced' that I have printed in an inline table to be able to match the number against significance.

Then I have another qvd-file named OrderChange, which contains,  'updated (time/date)', ' orderInvoiceId' and statusId'Today I have made a mapping for each number like this:

Map_Reviewed2Invoice:
orderInvoiceId,
updated
RESIDENT OrderChange where statusId = 1;  // Reviewed

Map_Announced2Invoice:
orderInvoiceId,
updated
RESIDENT OrderChange where statusId = 2;  // Announced

After that, I have the "main qvd-file" where I have fields like 'orderInvoiceId', 'orderId' and the invoice amount, which I use my mappings with in an applymap function, for example: 

ApplyMap ('Map_Reviewed2Invoice', orderInvoiceId) as Reviewed,
ApplyMap ('Map_Announced2Invoice', orderInvoiceId) as Announced

I do this, to be able to know what date the invoice per orderId, has been reviewed, announced, invoiced and so on..The whole Qlik app is too follow upp SLA. 

Hope I explained better now. How can I avoid doing all these 31 mappings?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

See the "Project Phase" example here https://qlikviewcookbook.com/2010/05/use-cases-for-generic-load/

-Rob