cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Collection Function

I've created a bunch of Collections. I did this by creating a button for each Collection, clicking each button to trigger and create each Collection, and I open each Collection to very data. However, once I delete the button that created the Collection I get red error messages all over my Gallery(ies). Apparently, the Collection can't exist without the button? Will I have to have a screen full of just button for the Collections?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Collection Function

Thanks @Phishdawg ,

Can you please Accept as Solution to allow other users to find it more readily. It also closes the item.

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Collection Function

@Phishdawg ,

A heap of questions - I will try to cover them but if you want further information, this needs to be on a new thread as it does not relate to your original question.

Is there a trick to writing filters that involve 'Collections' rather than when they involve 'Lists'?
No - collections are actually copies of the list, but only exist while the app is running.

I keep running it my formula/filters for Collections not working. Admittedly, I'm extremely ignorant to this entire environment. New immigrant from InfoPath. 
If you refer to them the same way (using the collection name rather than the list name), they should work exactly the same with the added benefit of no delegation issues on any filters or operators.

Is there some memory trick regarding when to use Selected, Selected.Text, SelectedText, Result vs. Value?

.Selected (on its own) will actually return a table. For a single line of text, the bit after .Selected refers to the Items of the control.

  • A Choice or Lookup field will be .Value
  • A Distinct filter will be .Result
  • If based on a field, it will be the actual Field Name

Very easy to find however - just type YourControlName.Selected. (note second dot) and it will come up underneath.

.Text is for Text Controls and .SelectedDate for Date Pickers.

Also, I added ClearCollect(BlahCollection,BlahList), to the 'OnVisible' of the screen. The DD, Gallery and Collection work together, however the Collection is only returning data on the first four (of the seven) associated records. All the above returning personnel data. The DD shows seven employees. When I click on the first four, data in the Gallery (based on the Collection) appear just fine. However, when I click on DD names 6 - 7 no data appears in the Gallery. The DD has: Distinct(Filter(BlahList, Unit=DD.Selected.Value),Name)

This will be the Filter on your gallery and how it relates to the data on the ones missing. You will find there will be a logical explanation for this (there always is)
Lastly, I can't seem to figure out how to write the above so that it is pulling the information in the DD from BlahCollection and not the BlahList. Isn't that the point of the Collection?
Distinct(Filter(BlahCollection, Unit=DD.Selected.Value),Name)

View solution in original post

9 REPLIES 9
Highlighted
Community Champion
Community Champion

Re: Collection Function

Hi @Phishdawg ,

A collection only exists while the app is running and needs to be created by a trigger. A button is one way of doing it. If there is no trigger to create it PowerApps simply says it cannot exist as there is nothing to create it.

If you put exactly the same code (one after the other - you can even wrap them in a Concurrent command) at App OnStart, all your collections will be created as soon as the app opens and all your error messages will go away.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Highlighted
Microsoft
Microsoft

Re: Collection Function

@Phishdawg 

 

Instead of having a bunch of buttons, you can also create these collections in the OnVisible event of one screen. 

Highlighted
Community Champion
Community Champion

Re: Collection Function

Thanks @EricaBao ,

That will also work as well as the App OnStart I suggested.

Highlighted
Community Champion
Community Champion

Re: Collection Function

Hi @Phishdawg ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper II
Helper II

Re: Collection Function

Yes, adding the formula to the 'OnVisible' did work. Thank you.

Highlighted
Community Champion
Community Champion

Re: Collection Function

Thanks @Phishdawg ,

Can you please Accept as Solution to allow other users to find it more readily. It also closes the item.

View solution in original post

Highlighted
Helper II
Helper II

Re: Collection Function

Is there a trick to writing filters that involve 'Collections' rather than when they involve 'Lists'?

 

I keep running it my formula/filters for Collections not working. Admittedly, I'm extremely ignorant

to this entire environment. New immigrant from InfoPath. 

 

Is there some memory trick regarding when to use Selected, Selected.Text, SelectedText, Result vs. Value?

 

Collections for dummies? Anything like that? Am I making this harder than it really is? 

 

Highlighted
Helper II
Helper II

Re: Collection Function

Also, I added ClearCollect(BlahCollection,BlahList), to the 'OnVisible' of the screen. The DD, Gallery and Collection work together, however the Collection is only returning data on the first four (of the seven) associated records.

 

All the above returning personnel data. The DD shows seven employees. When I click on the first four, data in the Gallery (based on the Collection) appear just fine. However, when I click on DD names 6 - 7 no data appears in the Gallery.

 

The DD has:

Distinct(Filter(BlahList, Unit=DD.Selected.Value),Name)
 
Lastly, I can't seem to figure out how to write the above so that it is pulling the information in the DD from BlahCollection and not the BlahList. Isn't that the point of the Collection?
Highlighted
Community Champion
Community Champion

Re: Collection Function

@Phishdawg ,

A heap of questions - I will try to cover them but if you want further information, this needs to be on a new thread as it does not relate to your original question.

Is there a trick to writing filters that involve 'Collections' rather than when they involve 'Lists'?
No - collections are actually copies of the list, but only exist while the app is running.

I keep running it my formula/filters for Collections not working. Admittedly, I'm extremely ignorant to this entire environment. New immigrant from InfoPath. 
If you refer to them the same way (using the collection name rather than the list name), they should work exactly the same with the added benefit of no delegation issues on any filters or operators.

Is there some memory trick regarding when to use Selected, Selected.Text, SelectedText, Result vs. Value?

.Selected (on its own) will actually return a table. For a single line of text, the bit after .Selected refers to the Items of the control.

  • A Choice or Lookup field will be .Value
  • A Distinct filter will be .Result
  • If based on a field, it will be the actual Field Name

Very easy to find however - just type YourControlName.Selected. (note second dot) and it will come up underneath.

.Text is for Text Controls and .SelectedDate for Date Pickers.

Also, I added ClearCollect(BlahCollection,BlahList), to the 'OnVisible' of the screen. The DD, Gallery and Collection work together, however the Collection is only returning data on the first four (of the seven) associated records. All the above returning personnel data. The DD shows seven employees. When I click on the first four, data in the Gallery (based on the Collection) appear just fine. However, when I click on DD names 6 - 7 no data appears in the Gallery. The DD has: Distinct(Filter(BlahList, Unit=DD.Selected.Value),Name)

This will be the Filter on your gallery and how it relates to the data on the ones missing. You will find there will be a logical explanation for this (there always is)
Lastly, I can't seem to figure out how to write the above so that it is pulling the information in the DD from BlahCollection and not the BlahList. Isn't that the point of the Collection?
Distinct(Filter(BlahCollection, Unit=DD.Selected.Value),Name)

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (10,780)