Array display as table

In script I want to display the array one after another in table format
Name Asset
This is my response of data action
{
"ctp_assetdescriptionarr": [
"BMW X1",
"Audi RS7"
]
}

and If I use the text input in script
image

I went through this Markdown genesys document but I am not getting how to implement it and show the values in tabular format can someone guide me please

I have gone through the developer tools questions but I did not find any solutions so if incase you are sharing me reference please check if proper solution is there because I am a new bee won't understand things if it is not from the start

There are two way to do this:

  1. Use a transfer to secure flow in the script when the call is connected between agent and cliente. In the secure flow you can call the dataAction and built the markdown text (use a string collection variable), and set this variable as a participant data. Return the call to the agent and get the markdown value from the variable setted in the secure flow.
  2. With a trigger that calculate the markdown based in a condition setted in the script.

I got it but it requires looping in the script and in order to loop in the script we can use recursion.


Initialize your string table (string) as

"|Title|
| --- |"
without the quotations

Initialize your iterator (num) to 1

Next is to make dynamic variables in your recursive step:
length of table (dyn num): length({{List of elements}})
element (dyn str): {{List of elements}}[{{table maker iter}}]

Next is your recursive step:

Use less than or equals due to indexing starting at 1


Place the string table into a MARKDOWN textbox and run the action.
list_output

If you are make a table with rows and columns then you would need another recursive action to generate the columns for every row.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.