Help - How to sort JavaScript items in an alert Activity
I have a technical workflow that captures fields from the technical workflow and writes them to an alert activity. The code (below) is working correctly but the output is not sorting by date even through the temporary work table is properly sorted. Can someone advise the best way to sort the item <%= formatDate(item.CreationDate, "%A %D %B %4Y") %>
JS Activity:
var query = xtk.queryDef.create (
<queryDef schema= "temp:query2" operation="select">
<select>
<node expr="CreationDate"/>
<node expr="@appointment"/>
<node expr="Registrations"/>
<node expr="Origin"/>
</select>
</queryDef>)
var itemsXML = query.ExecuteQuery();
vars.itemsXMLString = itemsXML.toXMLString()
Alert item:
<% var itemsXML = new XML(vars.itemsXMLString) for each (var item in itemsXML){ %><% } %>
| Creation Date | Origin | Appointment | Registrations |
| <%= formatDate(item.CreationDate, "%A %D %B %4Y") %> | <%= item.Origin %> | <%= item.@appointment %> | <%= item.Registrations %> |
Current Output:
Creation Date | Origin | Appointment | Registrations |
Fri 23 Oct 2020 | Blood Type Compatibility Chart | 0 | 32 |
Sun 18 Oct 2020 | Blood Type Compatibility Chart | 0 | 28 |
Sat 24 Oct 2020 | Blood Type Compatibility Chart | 0 | 15 |
Wed 21 Oct 2020 | Blood Type Compatibility Chart | 1 | 1 |
Mon 19 Oct 2020 | Blood Type Compatibility Chart | 0 | 31 |
Tue 20 Oct 2020 | Blood Type Compatibility Chart | 0 | 23 |
Mon 19 Oct 2020 | Blood Type Compatibility Chart | 1 | 1 |
