Search code examples
pentahopentaho-spoonpentaho-data-integration

Fill Previous Values - Pentaho Data Integration


I would like to fill the null values in StoreName with the previous StoreName values. For example the first 7 products are based in the "AKHİSAR" store but the store name is valid for only the first row because of the Excel formatting.

enter image description here

Here is what i want to achieve:

enter image description here

I'm not sure if i can do this with Replace in String step.

And i'm using Pentaho 9.0 version.

Thanks in advance!


Solution

  • You can achieve this with the help of Modified JavaScript Value step in Pentaho. Below are the steps:

    1. Drag and drop javascript step into your transformation and open the step.

    2. Write a script as below:

      if (StoreName != null){
         var updateStoreName = StoreName;
      }else{
         CONTINUE_TRANSFORMATION
      }
      

    A sample gist is provided in here for reference.

    enter image description here

    If you are using the Javascript in compatibility mode, then you may have to change the variable assigned accordingly. More is available in the official documentation.