Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Simplified example:
I'm trying to calculate a fieldvalue in every row of a table.The calculation of the value is based on the previous record where only the first record is known. The formula looks like this: 6 * previous(fieldvalue).
Only the value of the first record is known. For example the Calculatedfield value of record 4 is based on the previous calculatedfield value of record 3 which is unknown.
RowID | Calculatedfield |
1 | 2 |
2 | |
3 | |
4 | |
5 | |
6 |
I tried some do while loops but I can't get it to work. Any suggestions are very welcome!
You shoul be able to solve that operation by using Peek() during load.
T1:
LOAD * Inline [
F1, F2
1, 4
2, 0
3, 0
];
T2:
LOAD
F1 as F3,
if(RowNo()=1, F2, Peek(F4) * 6) as F4
RESIDENT T1;
You shoul be able to solve that operation by using Peek() during load.
T1:
LOAD * Inline [
F1, F2
1, 4
2, 0
3, 0
];
T2:
LOAD
F1 as F3,
if(RowNo()=1, F2, Peek(F4) * 6) as F4
RESIDENT T1;
Thanks Toni, exactly what I was looking for. Good to know that QV peek function looks at the previous modified record and not at the 'original' table record.