Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to implement for loop in Qlikview

Hi

How to check previous record with the help of for loop

Regards

Ashish

4 Replies
sparur
Specialist II
Specialist II

Hello,

previous(FieldName)

or

peek(FieldName)

Not applicable
Author

Hi Ashish,

Using for loops in qlikview is like using for loop in any other programming language. here you nee to use variables as flags. that is if you want to write a for loop, first you have to set a vriable to your count. I have given a small illlustration on how to use for loops in QlikView. this is a small code to show how its syntax comes.

let y=noofrows('tab1');
for i=1 to $(y)
a=mid(fieldvalue(cond.,xxx,yyy);
next i;

Hope this helps you.

Thanks Joseph........









Not applicable
Author

thanks Thopz helping me

my problem is

i have one table

table contain trip id booking date tripname tripamount totalfare bookingcalss flight# departuredate farebasic

i have give discount those how book ticket late but paid less amount in compare previous book ticket

just take example

case 1 ) trip id 1004012867 book the ticket 4/1/2010 01:40:04 . PM and paid total fair 4918.44

case 2) trip id 1004158104 book the ticket 4/15/2010 11:53:31 . PM and paid total fair 4912.44

case 3) trip id 1004158104 book the ticket 4/15/2010 11:53:31 . PM and paid total fair 4885.44

then i give discount on case 1 and case 2

case 1) get discount 4918.44 - 4885.44 =33

case 2) get discount 4912.44 - 4885.44 =27

how can we do please help me


Trip IDBooking Date/TimeTrip NmaeTrip AmountTotal FareBooking ClassFlight #Segment Departure Date TimeFare Basis
10040128674/1/2010 01:40:04 . PMKathmandu - New Delhi one-way4918.444918.44O5025/1/2010 02:40:00 . PM[OSFOWNP]
10041263984/12/2010 07:16:42 . PMKathmandu - New Delhi one-way9824.884912.44O5025/1/2010 02:40:00 . PM[OSFOWNP]
10041581044/15/2010 11:53:31 . PMKathmandu - New Delhi one-way33636.224885.44O5025/1/2010 02:40:00 . PM[OSFOWNP]
10042383194/23/2010 10:26:49 . PMKathmandu - New Delhi one-way5132.175132.17O5025/1/2010 02:40:00 . PM[OSFOWNP]


Not applicable
Author

hi

I am waiting for your help

Regards

Ashish