Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Problems with ClearCollect Function

(0) ShareShare
ReportReport
Posted on by 33

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard