Skip to main content

Notifications

Copilot Studio - General
Answered

How to append to table variable? (preview)

Posted on by 10

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:
  • iCodeSometime Profile Picture
    iCodeSometime 10 on at
    Re: How to append to table variable? (preview)

    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}"

     

  • HenryJammes Profile Picture
    HenryJammes on at
    Re: How to append to table variable? (preview)

    Awesome!

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

  • iCodeSometime Profile Picture
    iCodeSometime 10 on at
    Re: How to append to table variable? (preview)

    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 🙂

  • Verified answer
    HenryJammes Profile Picture
    HenryJammes on at
    Re: How to append to table variable? (preview)

    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

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,997

#3
Expiscornovus Profile Picture

Expiscornovus 1,708

Leaderboard