MintMeister | 2024-12-10 10:09:58 UTC | #1
Hi all,
We have a data table where the key field holds a list of brands and towns (in the format brandtown). 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": { "MerkPlaat": "$.entities[*].key" }, "translationMapDefaults": {}, "successTemplate": "{ \"Plaat\" : $MerkPlaat.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.
SimonBrown | 2024-12-10 10:18:11 UTC | #2
Not a direct answer but more a design question.
Why not have a separate table with valid Brands, and read that instead?
MintMeister | 2024-12-10 10:24:05 UTC | #3
Hi Simon, It's the towns that I'm interested in, rather than the brands.
I could have a table that just holds the towns, but that would then mean I would need to update 2 tables if a brand opened a location in a new town.
At the moment, when this happens, I need to add the "brand_town" to the existing table, along with all the other required information. I then need to manually add the new town to the drop-down list in the script, so it can be selected by an agent.
I was hoping to find a way to just update the existing table, in order to reduce the duplication of effort, but if it can't be done then I will continue to just update the dropdown in the script manually, rather than having another data table.
Thanks for the suggestion though! :slight_smile:
system | 2025-01-10 10:24:07 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 30775