Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaskarsharma03
Creator
Creator

Loop through records

Hi,

I need to loop through records in a table to find a matching record, and
then compare them with some criteria.


Attached are 2 files - if you check the excel file, I need to pick one Parent
ID
, and then loop through the column ID, if a
matching record is found then I need to compare these two rows with the
criteria given towards the right side of the excel file.

The New ID field in the file is the required outcome.

Any help will be greatly appreciated. Please let me know if more clarification
is required.

Regards,

Bhaskar

1 Reply
swuehl
MVP
MVP

Try maybe something along these lines:

ParentMap:

MAPPING LOAD

        MonthStart(Date) & ' - ' & [ID],

        [ID]

FROM

[New ID-1.xlsx]

(ooxml, embedded labels, table is Sheet1)

WHERE Stage = 'Sold';

LOAD ID,

     Date,

     Stage,

     Amount,

     [Parent ID],

     [New ID] as ReqID,

     if(Stage = 'Sold' and Amount <0, applymap('ParentMap',Monthstart(Date) &' - ' & [Parent ID], ID), ID) as [New ID]

FROM

[New ID-1.xlsx]

(ooxml, embedded labels, table is Sheet1);

edit: You will need to adapt the filename of the excel