Hi all,
We have a data table where the key field holds a list of brands and towns (in the format brand_town). I am trying to take this list, remove the "brand_" piece from the start and just get a list of all the towns.
I have been able to do this using the following Request and Response.
Request: -
{
"requestUrlTemplate": "/api/v2/flows/datatables/{dataTableId}/rows?pageSize=500&showbrief=false&sortOrder=ascending",
"requestType": "GET",
"headers": {
"Content-Type": "application/json",
"UserAgent": "PureCloudIntegrations/1.0"
},
"requestTemplate": "${input.rawRequest}"
}
Response: -
{
"translationMap": {
"Merk_Plaat": "$.entities[*].key"
},
"translationMapDefaults": {},
"successTemplate": "{ "Plaat" : $Merk_Plaat.replaceAll("Brand1_|Brand2_|Brand3_", "") }"
}
I am calling the Data Action from a script, and the results are added to a ListType variable which I use to populate a drop-down. This all works perfectly, but the problem I have is that some of the towns have multiple brands associated with them, so I am getting duplicate values in my drop-down. I also have the problem that once the brand name is removed, we have a list that is not sorted alphabetically any more (it has a sort order like: -
A...
B...
C...
...
Z...
A...
B...
C...
...
Z...
A...
B...
C...
...
Z...)
Is there a way for me to remove the duplicates (and then to sort the remaining values alphabetically)?
Any assistance would be gratefully received.