Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load the value of a calculation for one row of a table for all rows of that column

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.

2 Replies
hic
Former Employee
Former Employee

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

rlp
Creator
Creator

You could procede more quickly

LEFT JOIN( Table)

LOAD

     * ,

     <your_calculated_field> as new_field

RESIDENT Table ;