Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I have a calculation in the script that gives the value for one row and one column of a table. Is there anyway that I can include that that value for all the rows of the column. The column is blank otherwise.
You can use the peek() function to propagate a value downwards, so that all records below get this value. E.g.
Load *,
if(IsNull(Field), Peek(Field2), Field) as Field2
from ...
If you want all records - also the ones above - to get this value, you need to do it in two passes:
Temp:
Load * from ...
Table:
Load *,
if(IsNull(Field), Peek(Field2), Field) as Field2
resident Temp
order by Field desc;
Drop Table Temp;
so that you get the missing values below the records that have values.
HIC
You could procede more quickly
LEFT JOIN( Table)
LOAD
* ,
<your_calculated_field> as new_field
RESIDENT Table ;