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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
pk
Contributor III
Contributor III

for loop

Hi All,
Want to read QVD no of rows and add for loop and read the values from that file/QVD

I have one QvdList.txt file like
QVDName|Flag
QVD12.qvd|1
QVD2.qvd|0
QVD3.qvd|1
QVDTest.qvd|0

want to count the no of rows and apply For loop till the count of Rows and print the values of Field1(QVDName) & Field2(Flag) in variables

I loaded this .txt file into qlikview and used below code to get the row counts from the table/file-
Let vCount = NoofRows(TablName/QvdName)-So in this case vCount will be 4.

So now how we can apply/add For loop till 4 and print the values ?

Thanks in advance!

Labels (1)
1 Reply
maxgro
MVP
MVP

try this

TableName:
LOAD * INLINE [
QVDName|Flag
QVD12.qvd|1
QVD2.qvd|0
QVD3.qvd|1
QVDTest.qvd|0
] (delimiter is '|')
;

Let vCount = NoofRows('TableName');

FOR i=0 TO vCount-1

trace $(i);
LET vQVDName = PEEK('QVDName', $(i), 'TableName');
LET vFlag = PEEK('Flag', $(i), 'TableName');TRACE vQVDName=$(vQVDName) vFlag=$(vFlag);

NEXT