Question

Calculating a Parameter

  • 20 September 2023
  • 1 reply
  • 25 views

Hi,

I need to use a calculated date in a pipeline, more specifically I need to make an HTTP call, where a date range of the form of a ‘From’ and ‘To’ date, of the form “2023-09-10”.

I can calculate this date as a field in a record using 

${time:extractStringFromDate(time:dateAddition("DAY",-1,time:now()),"yyyy-MM-dd")}

 

But this does not work in the ‘required data’, what would normally be the request body in a post request

It seems I can use a parameter in this section as follows 

{"entity":"user","operation":"Login","userName":null,"fromDate":${FDate},"toDate":${TDate},"toDateVal":"2022-07-21T00:00:00.000Z","fromDateVal":"2022-01-01T00:00:00.000Z"}

but when I try to create a parameter that calculates the date, using the above formula, I get an EL expression error 

Can someone suggest where I am going wrong?

I have also tried using start jobs, to pass the dates as a parameter, but that also doesn’t seem to work, I can pass a manually entered date to this ‘child job’ but it seems to convert them from string into another form (can’t figure what happens here).


1 reply

Userlevel 5
Badge +1

@southwr62 

can you please give a try the below message.

{"entity":"user","operation":"Login","userName":null,"fromDate":”${FDate}”,"toDate":”${TDate}”,"toDateVal":"2022-07-21T00:00:00.000Z","fromDateVal":"2022-01-01T00:00:00.000Z"}

Reply