0

I have a SQL query as mentioned below and this will update DB every day comparing the date (latest appended date data will be updated in DB) and I want to do this in transformations using Pentaho Data Integration (Kettle).

Do While i < dgTest.RowCount
     dd = Mid(dgTest.Item(2, i).Value, 5, 2) & "/" & Mid(dgTest.Item(2, i).Value, 7, 2) & "/" & Mid(dgTest.Item(2, i).Value, 1, 4)

     Sql = "INSERT INTO cash ([comp], strno, bday, openread, curread,refqty,refamt, promoq," & _
          " promoa, netsprod, netsnprod, eatintc, eatins, eatouttc, eatouts, " & _
          " dttc, coffeetc, dts, coffeesales, csh, cover,recamt,crsalesamt ) Values " & _
          " ('" & dgTest.Item(0, i).Value.ToString & "','" & dgTest.Item(1, i).Value.ToString & _
          "',#" & CDate(dd) & "#,'" & dgTest.Item(3, i).Value.ToString & "'," & dgTest.Item(4, i).Value & "," & _
          dgTest.Item(5, i).Value & "," & dgTest.Item(6, i).Value & _
          "," & dgTest.Item(7, i).Value & _
          "," & dgTest.Item(8, i).Value & "," & dgTest.Item(9, i).Value & _
          "," & dgTest.Item(10, i).Value & "," & dgTest.Item(11, i).Value & _
          "," & dgTest.Item(12, i).Value & "," & dgTest.Item(13, i).Value & "," & dgTest.Item(14, i).Value & _
          "," & dgTest.Item(15, i).Value & "," & dgTest.Item(16, i).Value & "," & dgTest.Item(17, i).Value & "," & dgTest.Item(18, i).Value & "," & dgTest.Item(19, i).Value & "," & dgTest.Item(20, i).Value & "," & dgTest.Item(21, i).Value & "," & dgTest.Item(22, i).Value & ")"

      cmd = New OleDbCommand(Sql, con)
      cmd.ExecuteNonQuery()

      i = i + 1
 Loop
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

I don't understand the approach you are trying to implement but what you can do is from input table step read the data, use modified java-script and specify that on this particular time update the database.. example

    var d = new Date();
    var hour1 = d.getHours();

 if(hour1==14)
    {
        if(d.getDate()==day2 && month1==month2 && year1==year2 && hour>=13 && hour<17)
    }
Marlon Abeykoon
  • 11,927
  • 4
  • 54
  • 75
Helping Hand..
  • 2,430
  • 4
  • 32
  • 52