Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

array position assign date time bin

I have a need to assign a DateTime value based on the position of the value within an array. Unfortunately the API endpoint I am using doesn't supply a DateTime index I can use, but I do control the request parameters with a start and stop DateTime and the data comes in an array; in other words I would ask for 4 hour increments with a start and stop of Jan 7 to Jan 8 and I am guaranteed 4 entries in the array and they will be in the correct order, or if I ask for 1 hour increments I would get 24. All I have to do after pivoting the array to rows is to assign the correct date and 1-hour increment with a presumption the first is 1 am UTC.

Is there a function that I can call or will this have to be in some Jython Script?

Input

{ "timedata": [ 10,24,45,16,12,22 ], "source" : "somewhere" }

expected result

|| timedata  || source || ETL_datetime ||
| 10 | somewhere | 2019-01-07 04:00:00 |
| 24 | somewhere | 2019-01-07 08:00:00 |
| 45 | somewhere | 2019-01-07 12:00:00 |
| 16 | somewhere | 2019-01-07 16:00:00 |
| 12 | somewhere | 2019-01-07 20:00:00 |
| 22 | somewhere | 2019-01-08 00:00:00 |