# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Highlighted
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.

P.S.: App in attachment.

Tags (4)
1 Solution

Accepted Solutions
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.

2 Replies
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.

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