Question : Date increment loop using Javascript in Pentaho Data Integration

I am looping through a database field that is a string of characters (Calendar) which I am inserting a new row into a new database table for each character in the field. I want to be able to increment the date by one day for each character in the field, the start date for the first character will need to be entered as a fixed value for the first date of the year then increment by one day for each character. I have the function looping through the string ok but cannot seem to get the date to loop afetr each insert, each option I try seems to throw an error on the date format in Pentaho.

The code I am using is attached


Thanks
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var eachchar = Calendar.split("");
var dt = "2010,01,01";

  for (i=0;i<eachchar.length;i++)
  {
    newRow = createRowCopy(getOutputRowMeta().size());
    var rowIndex = getInputRowMeta().size();

    newRow[rowIndex++] = trim( eachchar[i] );
    newRow[rowIndex++] = dt;
    putRow(newRow);
  }

Answer : Date increment loop using Javascript in Pentaho Data Integration

this is how you add a day in a javascript date

var myDate = new Date();
myDate.setDate(myDate.getDate() + 1);
Random Solutions  
 
programming4us programming4us