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 / How to append to table...
Copilot Studio
Answered

How to append to table variable? (preview)

(0) ShareShare
ReportReport
Posted on by 17

Hello. I'm pretty new to PowerFX in general, so not positive if this is missing functionality, or if I'm just not searching for the right keywords.

 

I'm asking the user for some selections using an adaptive card, splitting that into a table variable, and asking if there are more options they'd like to select (i.e. the next page of results)

From my searching, it seems like it should be something like

 

Collect(
 Topic.Selections, // Table Variable
 Split(Topic.NewSelections, ",")) // String variable

 


Or from the YAML for clarity

 

 - kind: SetVariable
 id: setVariable_igZwOP
 variable: Topic.Selections
 value: |
 =Collect(
 Topic.Selections, // Table Variable
 Split(Topic.NewSelections, ",")) // String variable

 


But I get an error that 'Collect' is an unknown or unsupported function.
Is Collect something that's just not implemented for the preview yet? Or is there a better way to do this?
In this case, I could just append to the string and split it at the end, but I'd like to figure out how table variables work.

Categories:
I have the same question (0)
  • Verified answer
    HenryJammes Profile Picture
    on at

    Hi @iCodeSometime,

     

    Indeed, you can't use Collect or Set in Power Fx in PVA. 

    But an update is coming to the PVA canvas to address table manipulation requirements.

    In the meantime, you can probably work around this by switching to the Code Editor view:

     

    HenryJammes_0-1684443098199.jpeg

     

    After the node where you have your Table variable:

     

    YAML

    kind: EditTable
          id: sendMessage_g5Ls09
          changeType: Add
          itemsVariable: Topic.YourTable
          value"={ id: \"XXX\", name: \"XXX\" }"

    I'm not sure what you're appending, so I used a 2-column record with an id and a name property.

     

    It will show as a new node in the canvas:

     

    HenryJammes_3-1684443436166.png

     

     

    Let me know if that unblocks you.

    Henry

     

    @iCodeSometime

  • iCodeSometime Profile Picture
    17 on at

    Thanks so much.

    I was able to get this working with

     - kind: EditTable
     id: editTable_fEiaAp
     changeType: Add
     itemsVariable: Topic.Selections
     value: |
     =Split(Topic.NewSelections, ",")


    I also discovered another new feature `- kind: Foreach`, which is cool.

    I am liking this preview version so much better already, seems like it will be great. Excited for it to be released 🙂

  • HenryJammes Profile Picture
    on at

    Awesome!

    General Availability for the unified authoring canvas is next week @iCodeSometime, so production support is really just around the corner 🙂

  • iCodeSometime Profile Picture
    17 on at

    Apologies, I'd thought it was working at first, but turns out it was creating a table of tables, and I just hadn't realized.

    For anyone else coming across this, here is a working version:

     

     - kind: SetVariable
     id: setVariable_ELzDVx
     variable: Topic.loopItem
     value: "\"\""
    
     - kind: Foreach
     id: foreach_afSDFIs
     items: =Split(Topic.NewSelections, ",")
     value: Topic.loopItem
     actions:
     - kind: EditTable
     id: editTable_rX8Wz9
     changeType: Add
     itemsVariable: Topic.Selections
     value: "={ Value: Topic.loopItem}"

     

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 251 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

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

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard