Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
lylererger
Contributor II

QV Script: Cycles vs Arithmetic Progression

Hi friends!

Help me to calculate the variable - X in script.

I don't need to use cycle, because processing of a cycle takes a lot of time.

Help to find the right way to calculate, as I said using Arithmetic Progression.

For Example cycle:

FOR vIx = 0 to 10

  LET X = X + vIx;

  NEXT vIx

equals

LET X = ((10+1)/2)*10;

It's okay.

But what i'm going to do when in my calculation I need to use values of each row of one table on each iteration.

How to replace processing of that cycle: ??? Any advices ? 

FOR vIx = 0 to 10

  LET l1 = Peek(FieldName(Sex,'tmp'),Age+vIx,'tmp');

  LET X = (X + vIx) + l1;

  NEXT vIx

I'm open for discussions.

Hope for yours help.

Thanks in advance !!!

P.S.: App in attachment.

1 Solution

Accepted Solutions
MVP
MVP

Re: QV Script: Cycles vs Arithmetic Progression

Maybe you can calculate the Sum of your Peek'ed values using an aggregation in a LOAD statement, see attached.

View solution in original post

2 Replies
MVP
MVP

Re: QV Script: Cycles vs Arithmetic Progression

Maybe you can calculate the Sum of your Peek'ed values using an aggregation in a LOAD statement, see attached.

View solution in original post

lylererger
Contributor II

Re: QV Script: Cycles vs Arithmetic Progression

Swuehl, as usual you helps me! Many many thanks to you!

P.S.: When from a retail you turn into insurance, it is necessary to change thinking