cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fatima
Frequent Visitor

Need help with populating a collection with Gallery Data

HI Guys,

 

I need help with loading a collection with data from a Gallery. Here are sample screenshots to better explain it.

This is a gallery that reports booth names and the overall score of every booth.

 

I need to report on the top 5 booths and their scores. My thought is that i need to create a collection, then sort tha data, and then may be flush the data back to another gallery.

I know that this problem can be as simple as a sort() function on the gallery, on the totalscore field, but the thing is that the total score value is a calculation that comes from a differnt screen. here is its function:

Text(Sum(Filter(Scores, TextBox1_4.Text in BoothDisplay.Value), Totalscore)

 

TextBox1_4 is the filter textbox showing above the gallery. 

 

I am a newbie in powerapps and any guidance is much appreciated!

 

image1.png

3 REPLIES 3
Community Support
Community Support

Re: Need help with populating a collection with Gallery Data

Hi Fatima,

 

I am not sure with you data source, say you are using SharePoint list. There are three Number columns in the list.

 

Then I create an app based on the list. A BrowseGallery screen would be automatically created.

 

Then add a Gallery control on a new screen, set its Items property as: FirstN(Sort(Employee,Sum(i3x0,if7g,vwhr),Descending),5). Then the top 5 items would be shown on the app.

 

To show the total value of the three Number columns, add a Label control on the gallery and set its Text property as: Sum(i3x0,if7g,vwhr).

3.PNG

 

Without creating a collection, I can show the top 5 items on another gallery. Hope my steps could be a reference for you.

 

Please feel free reply if you need more help.


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Fatima
Frequent Visitor

Re: Need help with populating a collection with Gallery Data

H iMabel,

 

Thank you for your reponse. I believe i cannot sort my gallery your way. Let me explain it better:

My data is coming from two SharePoint lists, Booths, which has the booth name and info, and scoring which calculates scores recorded against each booth. So its a one to may relation between both tables.

The screen below is actually Groups/sums all scores entered against each booth. So for example, Lemon Stand Heaven has 3 scores records created in the scoring table with a total of 84, and so on.

What i am trying to do is to sort data on this screen by the total score, which is (84, 204, 186,..). 

 

The items property of this screen for the gallery is Booth. and the text property of the label showing the numbers is set to Text(Sum(Filter(Scores, TextBox1_4.Text in BoothDisplay.Value), Totalscore), "[$-en-US]#,###.00").

 

I tried setting the Items propoerty of the gallery to 

FirstN(Sort(Booths, TextBox11_2, Descending), 5)    ------> TextBox11_2 is the textbox holding the numeric value

But i get the following error:

"This rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value."

 

Not sure where is  the problem. Otherwise a collection is needed. but again, i dont know how to populate a collection with gallery info.

 

Any guidance is appreciated.

 

 

Fatima
Frequent Visitor

Re: Need help with populating a collection with Gallery Data

Ok.. 

So i am trying now to populate the collection from the Gallery. 

On the OnVisible property of the screen, i have this code:

Collect(R1, {BoothName: BrowseGallery1_4.Selected.TextBox1_4.Text, Category: BrowseGallery1_4.Selected.Category.Value, GrandScore: BrowseGallery1_4.Selected.TextBox11_2.Text})

 

Where i collect data in every field of the gallery, on the hope that i can sort for the top 5 from the collection. However, i only get in the collection the selected data in the gallery.

How can i get "All" gallery data to the Collection?

 

 I feel like i am going in circles!

 

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,297)