Skip to main content

Greetings, everyone!

I need to import start and end times for SLA Headers via assyst ETM (database table sla - SLA Header Details, fields mon_start, mon_end, tue_start, tue_end and so on). My channel is defined with source = Directory and message format = CSV.

What is the JavaScript expression to parse my input data? Please consider date/time format as “dd/mm/yyyy hh:mi:ss”, where dd = day (two digits), mm = month, yyyy =  year (four digits), hh = hour (zero to 23, not AM/PM), mi = minutes and ss = seconds.

Thank you.

https://wiki.axiossystems.com/assyst11-4Wiki/index.php/Integrations:assystETM_1.5_-_Data_Mapping#common

Hi Mauro,

We have some common JavaScript functions available to Datamapper authors as linked from the wiki above. The key one for this would be common.parseDate(dateString, dateFormat). It takes the date value from your input, along with the target format (As described in Java SimpleDateFormat) to return a Date value.

In use, if we have a CSV file like:

mon_start mon_end ...
01/01/2022 09:00:00 01/01/2022 17:30:00 ...

 

Our Datamapper could have a field mapping to the “Mon Start” field for an SLA, with the following JavaScript expression:

common.parseDate(inboundn"mon_start"],'dd/MM/yyyy HH:mm:ss');

Which would look like this in the UI (With “Debug” running to show the result from the above CSV file)

Hope this helps!


Thanks a lot, SGrant89!! It works!

 

Best regards.


Reply