web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Convert table variable...
Copilot Studio
Unanswered

Convert table variable to a string for Power Automate flow

(1) ShareShare
ReportReport
Posted on by 44

Hi,

 

I have a table from an adaptive card, and I can't seem to concatenate this table to a string so I can send the variable to PA.

 

I tried using the the JSON() formula, but it does not support the table data type.

JSON cannot serialize.png

 

I have tried to concatenate the table to a string, but using Concatenate(Topic.selectedOptionsTable, "") returns an empty string, despite the table having values in it.

 

The adaptive card has the following JSON formula: 

{
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
      {
         "type": "Input.ChoiceSet",
         "id": "selectedOptionsTable",
         "isMultiSelect": true,
         "choices": [
            {"title": "Fire Protection", "value": "Fire"},
            {"title": "Drought Protection", "value": "Drought"},
            {"title": "Flood Protection", "value": "Flood"},
            {"title": "Extreme Temperature Protection", "value": "ExTemp"},
            {"title": "Crop Disease Protection", "value": "Crop Disease"},
            {"title": "Crop Pest Protection", "value": "Crop Pest"}
         ],
         "style": "compact"
      }
   ],
   "actions": [
      {
         "type": "Action.Submit",
         "title": "Submit",
         "data": {
            "cardSubmit": true
         }
      }
   ]
}
 
If I send the table variable as a message I can see it is a column table, in square brackets, with the values selected. For example: [“Fire”,“Drought”,“Flood”,“ExTemp”]
 
Am I concatenating this wrong? How can table variables be used?
 
Thanks
Categories:
I have the same question (0)
  • Nina131 Profile Picture
    44 on at

    Hi, 

    I have found a very tedious solution, so if anyone has a better solution, please add it here.

     

    After some trial and error, I have set 6 separate variables named Value1 to Value6. They check if the row count of the table is greater than the current index, and return the field using Index() if true, else "". Then I concatenate the value variables into a string. 

     

    eg. 

    Value1 = If(  1 <= Topic.RowCount,  Index(Topic.selectedOptionsTable, 1).Value,  "")

     

  • Verified answer
    HenryJammes Profile Picture
    on at

    Hi  @Nina131,

     

    For simple arrays, you can use the JSON formula, e.g.:

     

    JSON([1, 2, 3]) 

     

     

    But, for more complex cases, there's actually an undocumented node that you can set using the code editor view:

     

     - kind: SetTextVariable
     id: setVariable_IzY7HO
     variable: Topic.varYourString
     value: "{Topic.varYourTable}"

     

     

    HenryJammes_0-1708371465086.png

     

  • Nina131 Profile Picture
    44 on at

    Thanks so much!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 265 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 240 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard