copy previous row in next row by argument

Hello all,

I have the following situation. In Column (C2) I have no data if Column (C1) has an B, otherwise there is always data. Therefore my tables looks like this:

  • C1    C2    
  • A       2                
  • A       3
  • A       6
  • B       ?
  • B       ?
  • A       3
  • B       ?

What I need is a solution to copy the previous row in the next row, as long as there are Bs in Column (C1). The result should look like this:

  • C1    C2    
  • A       2                
  • A       3
  • A       6
  • B       6
  • B       6
  • A       3
  • B       3

The number of B-rows can vari a lot. 

Do you have any idea?

 

Thank you very much!

Ralph

Hi Ralph,

you have two possibilities. The first one is to use a Java Snippet and save the previous value in variable.

The second one is as follows: Use a lag column node, to get a new column with the previous value for each row. Use a Rule Engine, to replace the missings for B. You can also check for missing in the Rule Engine node.

Let me know if this helped you!

Cheers, Iris 

You can use the node “Missing Value” .

than you can choose what to do : complete with the previous value, fix value, most frequent value or next value, etc

3 Likes