Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
lylererger
Creator II
Creator 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
swuehl
MVP
MVP

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
swuehl
MVP
MVP

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

lylererger
Creator II
Creator II
Author

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