J.A
J.A

Reputation: 61

How can I replace the value of a field(s) based on another field(s) in Pentaho

I need to replace some values that I get from a database with the values of another field (same database), providing the other field is populated.

In my database I have the following fields (amongst others): RMM, RMY, IRM, IRY

If IRM is populated I need to replace the value in RMM.

If IRY is populated I need to replace the value in RMY.

If IRM / IRY are not populated, then RMM / RMY remain as they are.

I’ve created a filter which checks if IRM or IRY are null, if they aren’t, I have a set field value step where I set the respective values. I then use the append streams step to merge the path where the filter fails.

However, the problem with my current solution is that the or condition in my filter is causing some of the values to be replaced by nulls - since the condition in the filter only needs one side to be true.

Here is my current solution:

transformation

filter

Any help will be greatly appreciated.

Upvotes: 4

Views: 8034

Answers (1)

Cristian Curti
Cristian Curti

Reputation: 1054

You can do away with the Filter and the step and use a simple Formula step that , one for each column, that updates the value of RMM and RMY based on the value of IRM and IRY:

enter image description here

This way you are working on both columns separetely, testing nulls and replacing when needed.

Upvotes: 3

Related Questions