Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
prahlad_infy
Partner - Creator II
Partner - Creator II

where exists in loop not working

Hi All ,

In continuation to 
https://community.qlik.com/t5/New-to-Qlik-Sense/Loop-Match-Load-and-Store/m-p/1854116#M194562 

Please let me know , what is wrong with below code . Its fetching 0 records around exists . 

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


LET rowText = NoOfRows('LOOPDATA');
for i=1 to $(rowText)
let text = FieldValue('SRC',$(i));

main:

LOAD * ,

'$(text)' as PNN Where Exists('$(text)',FILED2) ;  


LOAD * INLINE [

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
];

STORE main into location.............\tbl$(i).qvd ;

next i ;

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Exists() uses a fieldname as parameter. You want to test for a value so instead do:

Where FILED2 = '$(text)' ;  

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Exists() uses a fieldname as parameter. You want to test for a value so instead do:

Where FILED2 = '$(text)' ;  

prahlad_infy
Partner - Creator II
Partner - Creator II
Author

I was trying to achieve this , but it seems not working . Any alternate way ? Please suggest loop.PNG