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

Community site session details

Session Id : fO2U1q4H333RqPIRnqRic2
Power Apps - Building Power Apps
Answered

Problems with ClearCollect Function

Like (0) ShareShare
ReportReport
Posted on 12 May 2023 16:45:07 by 37

Hi people.

Well, getting to the point, I'm having trouble when I try to load information contained in a Sharepoint list into a Power Apps collection. This is the list with an example item:

 c13.png

This is the code I'm using in the App object on the OnStart function: 

 

         ClearCollect(colExternos; 'Form Template')

 

And this is the output I'm getting:

c14.png

 

If anyone can give me any idea why this might be happening, before I blow my head off XD, it would be very helpful.

 

Thanks for the help and regards

  • Gerosaki Profile Picture
    37 on 15 May 2023 at 15:55:30
    Re: Problems with ClearCollect Function

    Update. It worked perfectly using the following syntax: 

     

    ClearCollect(colExternos; ShowColumns('Form Template';"Title"; "ColumnType"; "Required"; "Choises"))

     

    I think the general appearance of the table is due to the formatting change they did.

     

    Thanks and regards

  • Gerosaki Profile Picture
    37 on 15 May 2023 at 14:18:21
    Re: Problems with ClearCollect Function

    Particularly, regarding the function "ShowColumns" when I use it, the system tells me that "colExternos" is not a valid name and that is not recognized. Thanks anyway 😉

  • Gerosaki Profile Picture
    37 on 15 May 2023 at 13:48:46
    Re: Problems with ClearCollect Function

    I understand. But still, Power Apps keeps showing me the table in a messy way. At first, the names of the columns do not appear. Only when you double click do they appear. Nor does it allow me to navigate laterally through the table (in case it called all the columns that I already saw, which is not the best option, but the same). Do you have any idea why it might be happening? and how can it be configured? Thanks and regards.

  • Verified answer
    mmollet Profile Picture
    3,187 on 12 May 2023 at 20:31:03
    Re: Problems with ClearCollect Function

    What you are seeing is the return of every column the SP List has currently. Even if you have a custom view set up on the SP List it will return all columns/fields. You can request to only grab certain columns from SP and then this collection will look much more 'clean' and prettified like you are wanting.

     

    ClearCollect(myLocalCollectionName, ShowColumns(mySPListName, "Column1", "Column2","Column3"))

    This will take everything in mySPListName and move the data in the columns listed to a local collection called myLocalCollectionName. Your code would look something like this:

     

    ClearCollect(colExternos; ShowColumns('Form Template', "Titulo","ColumnType","Required","Choices","AgregarColumna"))

     

    Also while I am here I would suggest starting to keep spaces out of your column names in SP. Generally accepted rule is to not use spaces as they then require single quotes everywhere in your code in Power Apps and it causes a headache. So instead of "Column Type" just use "ColumnType". Many people dont like this becuase the words are together in forms but you can simple retype the form field titles instead of using Parent.Default. 

  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on 12 May 2023 at 19:34:48
    Re: Problems with ClearCollect Function

    What information specifically are you trying to load into your collection?  It looks about right, you're just getting EVERYTHING in the SharePoint list.

    Try this to view your data in another way (you'll need to enable improved data table control)

    Rusk_0-1683920087064.png

     

     

    Insert > Table > Edit fields > Select your desired columns.

     

    I find that an easier way to review what I'm dealing with vis the view you have a screenshot of.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete