I want to display a variable number of items so using an Adaptive card column set/column.
In Power Automate I can surface as an array.
In PVA Preview have converted string to table.
Each item is {"type":"TextBlock","text:"(field contents)"},
The table surfaces as a message like this but doesn't display in column.
["{\u0022type\u0022:\u0022TextBlock\u0022,\u0022text\u0022:LEX-1019},","{\u0022type\u0022:\u0022TextBlock\u0022,\u0022text\u0022:LEX-1108},","{\u0022type\u0022:\u0022TextBlock\u0022,\u0022text\u0022:LEX-1019},","{\u0022type\u0022:\u0022TextBlock\u0022,\u0022text\u0022:LEX-1019},","{\u0022type\u0022:\u0022TextBlock\u0022,\u0022text\u0022:LEX-1108},",""]
Does a table translate as an array to an Adaptive card element? Hlep please. Thanks, Richard UK
Card syntax is
Hi Henry. Success with your help.
I probably don't get it but my coding of split was to produce a table, which it did.
For low code this was easier to me than the ParseJSON you recommended and I have now got it to work.
Originally I did put the code in the adaptive card itself but nothing happened, I'd obviously done something wrong.
I then put the code in to create a variable.
I'm not sure why you're trying to split columns.
Say Power Automate returns this, in your Topic.Column variable:
{
"text": "DOG",
"type": "TextBlock"
},
{
"text": "CAT",
"type": "TextBlock"
}
To use this as dynamic content in your adaptive card, for example in a ColumnSet items, I would reference the variable using this:
ForAll(
Table(
ParseJSON(
Topic.Column
)
),
{
text: Text(ThisRecord.Value.text),
type: Text(ThisRecord.Value.type)
}
)
Hi Henry, thanks for asking.
I can successfully code the type/text string syntax to surface an array in a column set, as demonstrated in my examples showing the table created using Power FX or direct in the adaptive card.
When Power Automate sends the required syntax as a text string it needs to be converted into a table.
Whilst the split function creates the table okay it also introduces the unicode \u0022 apostrophe escape codes.
These codes prevent the table being surfaced in the column set.
I have tried 273 variations on a theme; with/without apostrophes, single quotes, no quotes, embedded quotes, square brackets, no square brackets, re splitting strings etc, etc.
My card topic example can surface tables in columns sets but not the table with the escape codes.
All code in previous attachment with examples shown previous (-1)
It's a real blocker for me so very keen to get it resolved.
Cheers, Richard
Hi @Anonymous, it looks like you made some good progress.
Can you clarify where you get stuck? Is it with rendering the below array as dynamic content in a ColumnSet in an adaptive card? (feel free to also share a sample JSON for it with dummy data).
{
"text": "DOG",
"type": "TextBlock"
},
{
"text": "CAT",
"type": "TextBlock"
}
Just discovered the code editor!
Neat so attached is the topic setup to try to get columns to work in an Adaptive card based on a string sent from Power Automate.
Described above as the table resulting from a split is corrupted by Unicode escape characters.
Cheers, Richard
I can now prove a table in PVA will behave as a Power Automate array and surface rows in an Adaptive Card column set.
Hard code in PVA example card surfaces two columns.
One table created with Power FX
Topic.CollectColumn
[ {type: "TextBlock", text:"Apples"},{type:"TextBlock",text:"Pears"}]
The other coded in the card
Produces
Apples Fred
Pears Harry
{
type: "AdaptiveCard",
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
version: "1.3",
body: [
{
type: "Container",
items: [
{
type: "TextBlock",
text: (Topic.Column)
}
]
},
{
type: "ColumnSet",
columns: [
{
type: "Column",
width: "140px",
items: (Topic.CollectColumn)
},
{
type: "Column",
width: "140px",
items: [
{type: "TextBlock", text: "Fred"},
{type: "TextBlock", text: "Harry"}
]
}
]
}
]
}
I setup a topic which calls Power Automate returning a fixed two element string as type and text above.
The problem is when the split function to convert it into a table introduces Unicode '\u0022' escape characters for each apostrophe.
Even if they are removed from the Power Automate string connection they appear in the table after the split and it all breaks.
Power Automate init string
{"text":"DOG","type":"TextBlock"},{"text":"CAT","type":"TextBlock"}
Screen shot shows some examples. Many variations with/without apostrophes and reformatting existing strings to get to here and nowhere.
Any ideas gratefully received please.
Cheers, Richard
The FactSet is just an example. I think the key thing here is to understand what part of the adaptive card JSON you want to make dynamic, generate it in JSON format in Power Automate before transforming it into a Power Fx table in your adaptive card formula.
Hi Henry,
Thanks for the extensive reply, I'll check it out properly when I've read up on 'Fact Sets', I'm not sure they present as an array would do in a column item as I can drive from Power Automate when surfacing in Team chats. Will let you know how it goes.
Cheers, Richard
Hi @Anonymous,
I’ve done and documented something very similar. Can you check this post and let me know if that helps you?
Henry
Romain The Low-Code...
25
Pablo Roldan
25
stampcoin
10