Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld happening right now! You can still join: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Creator II
Creator II

Loop Match Load and Store

Hello Everyone ,

I need help with loop in qlik (something which give me "jitters" ) . 

TABLE1

INPUTID
EMP1
EMP4
EMP7

 

TABLE2

FIELD1 FILED2
ID1 EMP1
ID2 EMP1
ID3 EMP1
ID4 EMP4
ID5 EMP1
ID1 EMP3
ID2 EMP1
ID3 EMP3
ID3 EMP4
ID4 EMP7
ID5 EMP6
ID1 EMP7

 

STEPS:

A. First Loop Begins
1. Fetch first value from INPUTID of TABLE1  - Eg EMP1
2. Fetch All the FIELD1,FIELD2 values from TABLE2 where FIELD2=(EMP1) Fetched from step row in temp table,
Note: FIELD2 should be renamed as MAIN to avoid synthetic keys
3.Left join above created temp table to TABLE2
4. Save data in Qvd 
Loop Ends
 
5.After all qvd's are created then a loop to load concatenate all qvds created in step 4

 

LOOPDATA:
LOAD * INLINE [
SRC
EMP1
EMP4
EMP7
];

 

Below is what is tried to being with , without success 


LET rowText = NoOfRows('LOOPDATA'); // get the total number of rows in LOOPDATA table

 

for i=1 to $(rowText) // loop through every row

let text = FieldValue('SRC',$(i)); //get the value for "SRC" field on each row

LOAD * ,
$(text) as NPN Where Exists($(text), PN) ;


LOAD * INLINE [
IID, PN
ID1 EMP1
ID2 EMP1
ID3 EMP1
ID4 EMP4
ID5 EMP1
ID1 EMP3
ID2 EMP1
ID3 EMP3
ID3 EMP4
ID4 EMP7
ID5 EMP6
ID1 EMP7

];

next ;

 

Thank You All

6 Replies
prahlad_infy
Creator II
Creator II
Author

@MarcoWedel 

Thank You again for another learning from you . 

prahlad_infy
Creator II
Creator II
Author

Hi @MarcoWedel ,

Basically i want to achieve below result using script , but in vain . Please help .

loop.PNG

MarcoWedel

is this the same problem you described in this thread?:
https://community.qlik.com/t5/QlikView-App-Dev/Help-for-Set-expression-to-fetch-count-of-possible-in...

If yes, then maybe the same solution might work here as well.

Do you need these QVD files created for other purposes as well?
If you only want them created to concatenate load them afterwards in the same application, then maybe they are not needed in the first place.

thanks for clarifying

Marco

prahlad_infy
Creator II
Creator II
Author

Yeah these seperate qvds are needed for specific purpose later.

But yes the immediate requirement to load concatenate.

Thank you again
prahlad_infy
Creator II
Creator II
Author

https://community.qlik.com/t5/QlikView-App-Dev/Help-for-Set-expression-to-fetch-count-of-possible-in...

Above thread was aimed to set expression flavor , unlike current thread which aims script based approach . 

prahlad_infy
Creator II
Creator II
Author

Hello Marco , Any help for this on script level