Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!.How can I make this to work in load script?
I have this in one table
ref
1
6
2
8
7
I need to load new table "calc" this way
calc
Start value, Same value as in Ref = 1
Current ref value/previos calc value 6/1=6
Current ref value/previos calc value 2/6=0.33
Current ref value/previos calc value 8/0.33=24.24
Current ref value/previos calc value 7/24.24=0.28
So new calc table must be like this
calc
1
6
0.33
24.24
0.28
Any help will be preciated.
Thanks in advsance
I gotcha. Here take a look at this.
Ref/Previous(Ref) as Calc
or Ref/Peek(Ref) as Calc
Thanks Wallo!
Previous and Peek does not work, I get "field not found", and O think this is because I'm creating "calc" value
Here's the code I wrote
tmpTableCalcWithPrevious:
LOAD *,
If(ref = 1, 1, ref/Previous(calc)) as calc
Resident tmpTableRef;
tmpTableWithPeek:
LOAD *,
If(ref = 1, 1, ref/Peek(calc)) as calc
Resident tmpTableRef;
Any clue?
This works for me.
Thanks again Wallo!! Your code works, but the calculation I need is different.
You're doing ref/Previous(ref) as calc
I need (but don't know hou to do it) ref/Previous(calc) as calc
I gotcha. Here take a look at this.
Awesome. Thanks a lot!!!