1

Within Pentaho's PDI, I am trying to go day by day from a start date until the current date. I am trying to pass this date to a Rest Client. So for example, I start 5 days ago, pass that date to the Rest client task, then go to 4 days ago, pass that date to the Rest client task, then go to 3 days ago, pass that date to the Rest client task, etc... until the current date. How do I accomplish this type of loop using PDI? Really appreciate any help or insight anyone can lend here.

Thanks!

slybitz
  • 689
  • 1
  • 7
  • 18
  • Thanks @jxc! I think this is exactly what I want but is there a tutorial vid or project out there that you know of with this to help me walk through this? – slybitz Sep 14 '20 at 16:27
  • the input is a start_date. thanks. – slybitz Sep 16 '20 at 20:13
  • Hello @jxc, apologies on my delay but I was planning to add feedback (and MORE than happy to do so) but seems like you removed the answer/help? Or am I missing something? Thank you so much for your time and help here! – slybitz Sep 21 '20 at 16:40

1 Answers1

1

Assume that the start_date is a parameter which you set up through the main menu Edit -> settings -> Parameters tab with the following entry:

Parameter: start_date
Default Value: 2020-09-10

then you can try the following transformation with 4 steps:

enter image description here

Step-1: Get System Info Step, add one field with Name=today and Type=Today 00:00:00

Step-2: Calculator Step, set up the following 3 fields: enter image description here

  1. _start_date: Set field to constant value A
  2. start_date: variable substitution in string A
  3. n_repeat: Data A - DataB(in days)

Step-3: Clone row Step, do the following:

enter image description here

  • Check Nr clone in field? and set the field name to n_repeat
  • Check Add clone num to and set the field name to rn

Step-4: Calculator Step, add three fields: enter image description here

  1. new_date: Date A + B Days
  2. base_uri: Set field to constant value A
  3. request_uri: A + B

Run the above transformation with start_date = '2020-09-10', we have the output: enter image description here

Note: you can add one more Select values Step to keep only desired fields.

jxc
  • 13,553
  • 4
  • 16
  • 34