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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

loop through a table

Hello

is there a way to loop through the records of a loaded table row by row?

please advise

what I also want is suppose I'm in row 2 I want to read columns of the previous row

I can walk on water when it freezes
1 Reply
Not applicable

Not knowing what is your objective her some examples for previous record and loop in the script

RawData:

Load * Inline [

     ID, value

     4, B

     2, A

     6, C

] ;

// using previous function

Data:

Load *,

     previous(ID) as PreID

     previous(value) as PreValue ;

Load *

Resident RawData

     Order by 'ID' asc ;

//one way of looping through teh records

for i = 1 to NoOfRows('Data')

     DataLoop:

     Load

          peek('ID', $(i)-1, 'Data') as LoopResultID,

          $(i) as LoopCounter

     Resident Data

          where $(i) = RecNo() ;

next