Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

For next loop not working

Hello Everyone,

I am trying to use For next loop in a Load Statement on a resident table A. But, it generates numerous rows,  while the resident table has only 900 rows.

Please help me in resolving the same ASAP.

I am trying with the following script;

set session=0;

FOR i = 0 TO NoOfRows('A_final_one')

A_FF_ONE:

Load

f_tgt as ff_tgt,

f_source as ff_source,

f_SSID as ff_SSID,

f_rssi as ff_rssi,

f_imp_day as ff_imp_day,

f_imp_date as ff_imp_date,

f_imp_time as ff_imp_time,

f_imp_year as ff_imp_year,

ff_time as fff_time,

$(session) as row_cnt,

if (ff_time > 6,1,0) as return_cust,

even(rowno()) as row_no,

if(even(rowno())=-1 and (f_source = previous(f_source)and f_imp_date = previous(f_imp_date)),

((((second(f_imp_time - previous(f_imp_time)))/60) + (minute(f_imp_time - previous(f_imp_time)))

  +(hour(f_imp_time - previous(f_imp_time)))*60)),0) as recwise_time,

  second(f_imp_time - previous(f_imp_time))/60 as sec,

  minute(f_imp_time - previous(f_imp_time)) as mints,

  Hour(f_imp_time - previous(f_imp_time))*60 as hrs

order by f_source,f_imp_date,f_imp_time;

set session=$(session)+1;

next i;