Search code examples
excelpentahokettle

Generating a dynamic date based on a row number using pentaho pdi


I want to generate a date dynamically based on row numbers using pentaho pdi. for example:

row 1 =====>Date=2015-06-08 **01**:56:30
row 2 =====>Date=2015-06-08 **02**:56:30
row 3 =====>Date=2015-06-08 **03**:56:30
row 4 =====>Date=2015-06-08 **04**:56:30

All my data come from an excel spreadsheet with row number and date fields and I want the date to change dynamically.


Solution

  • Easily done. Use an Add sequence step to generate the row ID. Then the Calculator step has a formula called 'Date A + B Hours'. It looks like this:

    Add Hours

    I hard coded the base date in the Generate Rows step.