Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following Code:
Calc_Temp:
Noconcatenate
LOAD
Key as Key,
CountN,
round( rangeavg(
peek(CountN,,-1),
peek(CountN,-2),
peek(CountN,-3),
peekCountN, -4),
peek(CountN,-5),
)) as averag5,
round( rangeavg(
peek(averag5,-1),
peek(averag5,-2),
peek(averag5,-3),
peek(averag5,-4),
peek(averag5,-5),
)) as avg5avg,
((peek(averag5)+peek(avg5avg))/2) as Finalavg,
num(peek(Finalavg,0))*1.6+ as DValue,
if ((CountN)>peek(DValue,0),peek(averag5,0),CountN) as Final
resident BasicData;
join Calendar;
Everything is working except the lines:
num(peek(Finalavg,0))*1.6+ as DValue,
if ((CountN)>peek(DValue,0),peek(averag5,0),CountN) as Final
There are errors but im out of ideas what it could be?
Hi
(peek(averag5)+peek(avg5avg))/2) as Finalavg,
num(peek(Finalavg,0))*1.6+ as DValue,
if ((CountN)>peek(DValue,0),peek(averag5,0),CountN) as Final
In this, you are creating new field named 'Finalavg'. You can't directly use the field name next line. Once the table load only, it create the Field. So only it shows error. Finalavg field is not found Like that..
Same reason for DValue also.
Hope u will understand.
Not existing on first row will at worst return null, but should not return an error.
What's that "+" after the 1.6, isn't that throwing an error ?
I create the Field averag5 what i use next line. Why should it a problem later?
But if I understand you correctly so I have to create a new table and load the data there. Then I can create this attribute?
"+" was only a copy mistake and didn't throws the error.
There are two comma's in peek(CountN,,-1). Other than that I don't see anything that would throw an error.
num(peek(Finalavg,0))*1.6+ as DValue,
if ((CountN)>peek(DValue,0),peek(averag5,0),CountN) as Final
Finalavg doesn't have a value on the first row so DValue will always be null. And then the if statement on the next line will always return CountN because the comparison between CountN and a null will return FALSE.