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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection to Table?
Power Apps
Answered

Collection to Table?

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, 

 

How can I turn a Collection into a Table function? I know a Collection is already a table, but how can I dynamically create a Table function based on the contents of a Collection?

 

Example

1. My Custom Connector requires Table input (thanks @Mike8!)

Table({name: "temp", units: "F"})

2. I have a gallery of potential parameters to pass to the Custom Connetor:

2018-10-18_17-47-34.png

3. Each parameter that is checked gets added to a collection (colSelected)

Collect(colSelected,
 {
 name: ThisItem.name, units: ThisItem.units
 }
 )

How can I parse colSelected and add the values, in the correct format, to the Table function in the Custom Connector?

I've tried doing a lookup for each parameter, but that errors out with "Internal Server error".  I started going down the path of a Switch statement for each parameter ("name" and "units") but that doesn't seem to work either.

Table(
 {name:
 Switch(
 colSelectedParameters.name,
 "temp","temp",
 "feels_like","feels_like"}
 )
)

Any ideas?

Categories:
I have the same question (0)
  • Mike8 Profile Picture
    1,330 on at

    Hello ericonline 🙂


    Clear(ColSelected);
    ForAll(TheGalleryNameThatYouHaveTheCheckedParameters.AllItems,
    If(CheckBox1.Value,Collect(ColSelectedParameters,{name:ThisItem.name,units:ThisItem.units}))

    It is not completely clear what you are trying to do but if I understood correctly and you are trying to add to a collection all the checked parameters, the formula above can help you.
    It iterates on the gallery that you have checked your parameters and if the checkbox is checked (true) it adds the record in the collection.

     

    You can also use the filter function..
    ClearCollect(colSelectedParameters,
    ShowColumns(
    Filter(TheGalleryNameThatYouHaveTheCheckedParameters.AllItems,CheckBox1.Value),
    "name","units")

    If the formulas above don't help, please explain a bit more what you are trying to do and we can find a solution.
    )

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the detailed response @Mike8.

     

    I'm able to Collect the parameters from the Gallery, using the checkboxes without issue. The place I'm stuck is turning this Collection into the Table function that my Custom Connector requires. 

    In our other thread, you helped me hardcode the Table function. I'm now trying to make it dynamic based on what is in colSelectedParameters.

    Basically, how do I get from here: 

    2018-10-19_8-35-16.png2018-10-19_8-35-35.png

    To here, dynamically:
    2018-10-19_8-37-28.png

     

  • seadude Profile Picture
    1,855 on at

    Any thoughts on this @Mike8? I also have this issue with an API.

     

    Thanks!

  • Verified answer
    Mike8 Profile Picture
    1,330 on at

    Hello,

    Can you try instead of     fields:Table({.................}) --> fields:colSelectedParameters..?
    It will pass the data from the collection.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Wow. That was dead simple. A Collection is a Table and can be interchanged with the Table function as long as the columns are the same. 

     

    Awesome. I feel a bit silly that I didn't try this... But Awesome, thank you!

  • Mike8 Profile Picture
    1,330 on at

    Yes, that's it.
    Not silly at all. Finally you would have found the way. We just made it a bit sooner.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard