Insert value in column of row+1 into previous row.

Hi, I have a messed up text file where one of the values is in another row. I’d like to place the numeric value into the previous row under basic_pKa. There are too many rows to do my hand. If I could get that value on the same row I’m sure I could place it with a rule engine. My idea was to figure out how to pass the row with the prediction value “Yes” and the previous row and then extract and insert the value but I’m stumped on how to accomplish that and don’t have any other ideas. I’ve attached a screenshot and attached the example file.

test3.txt (1.6 KB)

Thanks!
Jason

The attached workflow does what you want by introducing an artificial ID and rejoining the relevant values. Maybe there is a simpler way. LAG column only seems to work for referring to the rows before.

Also if you have ‘messy’ CSV files you might want to consider using the R package readr to help you with that (cf. Error with File Reader node while running in a loop)

kn_example_lag_messy_csv.knwf (49.5 KB)

2 Likes

Thanks @mlauber71 !!! I knew it would be a simple fix! Thanks so much!!

Jason

2 Likes