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 / Power Apps / Problems with ClearCol...
Power Apps
Unanswered

Problems with ClearCollect Function

(0) ShareShare
ReportReport
Posted on by 39

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

Categories:
I have the same question (0)
  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    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.

  • Verified answer
    mmollet Profile Picture
    3,187 on at

    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. 

  • Gerosaki Profile Picture
    39 on at

    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.

  • Gerosaki Profile Picture
    39 on at

    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
    39 on at

    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

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 > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard