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 / ClearCollect with Gall...
Power Apps
Answered

ClearCollect with Gallery.Selected is collecting form controls in addition to data columns

(0) ShareShare
ReportReport
Posted on by 95

Hi all

 

I have a very frustrating issue that is only present in a single environment. All other environments (of the same solution) work as expected.

 

I have a Gallery that is bound to a Dataverse table. The OnSelect of this gallery is set to something similar to the below with all nested form controls such as labels buttons etc set to Select(Parent):

 

 

ClearCollect(colProjects, ThisItem);

 

 

In the defective environment, after running the above code the collection now contains all of the Dataverse columns and values for the selected gallery item (This is a good thing). However, in addition the collection now has additional columns/values for each form control (e.g. Fields named Button1, Label1 etc).

 

Screenshot 2024-02-24 at 5.47.30 pm.png

 

I have tried many alternatives also including being specific on the fields that I want the collection to store:

 

 

ClearCollect(colProjects, ShowColumns(
 ThisItem,
 "cr07e_projectsid",
 "cr07e_approved",
 "cr07e_comments",
 "cr07e_contact",
 "cr07e_contactid",
 "cr07e_finish",
 "cr07e_hourstotalstaff",
 "cr07e_invoiceid",
 "cr07e_invoicenumber",
 "cr07e_name",
 "cr07e_projecthours",
 "cr07e_projectminutes",
 "cr07e_start",
 "cr07e_unitsbillable",
 "cr07e_staffhours",
 "cr07e_staffminutes",
 "statecode"
 )
);

 

 

However, the result is that the collection still contains the form controls as columns as well as the Dataverse columns. I have even substituted 'ThisItem' with 'GalleryName.Selected' and get exactly the same result.

 

Where it gets super interesting is that if I change the collection name from 'colProjects' to a new collection never used in the app, say 'colProjectsTempTest' it works as expected on all of the variations above and only collects the desired Dataverse columns/values.

 

Has anyone else experienced this behaviour, and what did you do to overcome. Ideally I would like to avoid changing the name of the collection as it is used extensively throughout the app all in slightly different contexts.

 

Any help would be greatly appreciated!

 

Thanks, Rob

 

I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @Nebulas ,

     

    Do you initialize or use this collection elsewhere in the app? It may be due to cache issue, you can try and clear browser cache then open the studio again.

     

    Best regards,

  • Nebulas Profile Picture
    95 on at

    Hi @v-jefferni 

     

    Thanks for your response. I actually looked it off as I had already taken these actions (or so I thought). After ripping the application apart for a few days without success, I thought I'd try and clear the cache again.

     

    I noticed that the dropdown menu was set to 'Last hour' as opposed to 'All time'. So obviously last time, I only cleared the last hour. After I cleared all time, signed out etc it is all now working as per normal.

     

    For clarity, even after clearing the cache, here are the results:

    • Gallery.SelectedItem: Collects data columns of the table and form controls within the gallery (This wasn't the case previously to my knowledge and I had used this method extensively throughout my apps in other env's)
    • ThisItem (of the Gallery): Collects only the data columns of the table and using in combination with ShowColumns enables me to limit the collection to exactly the columns I want to see in the collection.

    Also, the behaviour of this issue was that some of my ClearCollects were resulting in collecting form controls from a gallery that the code was in no way interacting with. This is the definition of corruption of data objects within the cache. In case this helps anyone else.

     

    Thanks for your support

     

    Rob

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard