cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinSun2000
Level: Powered On

Sum of items in a dynamic Gallery

I encounter a situation, that I put specially filtered items into a Gallery, and define some more complicated formula in each cell in the Gallery, put it in a text box. Then outside of the Gallery, another text box is defiined to be the sum of all these text boxes in the Gallery. 

The result came out correct when first evaluated. But when the program do anohter screen, and have a new output of the Gallery, I found the calculated result did not get updated. 

 

Can SUM function work on the Gallery.Allitems as it's input?

 

Martin

2 ACCEPTED SOLUTIONS

Accepted Solutions
MartinSun2000
Level: Powered On

Re: Sum of items in a dynamic Gallery

I thought I have posted an update last night on more explanation, but seems it got lost somewhere. 

More on describing the situation: the CustomControl in the Gallery is not only a simple column, but is a calculation based of several column and a LookUp call to other list. (see picture 5). That's why I could not call the Column direcly from the textBox outside the Gallery. 

 

But I found a temporary solution, by adding a button and do the "manual" calculation every time I come to this page. For the moment, an acceptable solution. 

View solution in original post

Power Apps Staff _Corey_
Power Apps Staff

Re: Sum of items in a dynamic Gallery

Final update: A hotfix to address the issue has been successfully deployed. The updated Studio version is v3.19052.20.115177617. You will need to edit your app(s) in Studio and re-publish for the fix to take effect--please remember that it make take up to a few minutes for the newly published app(s) to be packaged and available to players (web or mobile). Please report any issues you experience with this update.

Once again, we are sorry for any inconvenience this has caused.

View solution in original post

12 REPLIES 12
Anonymous
Not applicable

Re: Sum of items in a dynamic Gallery

Hi,

 

You mean that your sum isn't updating with your filter ?

For me it's working well, it's maybe because you have a lot of data, so it's a little bit slower ?

 

Louis

Dual Super User
Dual Super User

Re: Sum of items in a dynamic Gallery

Hi, 

 

You could add a formula to refresh the gallery when the screen loads. Please refer to the screenshot below: 

 

Picture2.png

 

 

You could also add a button to refresh the gallery (data source) so that you get the current/ latest data and the sum in the required field.Picture3.png

 

Please note: Autonumber and Autonumber_1 are my data sources. You can replace that with yours. 

 

Hope this helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

MartinSun2000
Level: Powered On

Re: Sum of items in a dynamic Gallery

Nope, it doesn't work. Actually, when I first ener the formula, it works OK (See picture 2).

Then after I go somewhereelse, and come back with the Gallery content changed, the contents in the Gallery was updated (see pictrure 3), but the content in the box outside did not get updated. The page OnVisible also contains a Refresh command, but it did not change anything.

Until I change the formula in the box again, it is updated (see picture 4). 

I wonder if the Sum does not apply to the Gallery type of table? Or at least not populated automatically?

 

Martin

Dual Super User
Dual Super User

Re: Sum of items in a dynamic Gallery

Hey! Can you share where are you extracting the data from? Is it sharepoint or CDS or soem extrenal data source? 

If so, in the formula, you have to enter the name of the column at the data source. 

Sum(Gallery4.AllItems, custControl)

Here custControl is the name of the column at my source and this column has been mapped to a label "Label_2" in the Canvas app. So it gives the desired results when i put the coulmn name instead of the [Label_2.Text]. 

 

Hope this helps!

 

Highlighted
Power Apps Staff _Corey_
Power Apps Staff

Re: Sum of items in a dynamic Gallery

@MartinSun2000 We have identified an issue with Gallery when aggregating values via the .AllItems property.  We are actively working on a hotfix.  We will keep the thread posted as we know more.  Sorry for any inconvenience.

MartinSun2000
Level: Powered On

Re: Sum of items in a dynamic Gallery

I thought I have posted an update last night on more explanation, but seems it got lost somewhere. 

More on describing the situation: the CustomControl in the Gallery is not only a simple column, but is a calculation based of several column and a LookUp call to other list. (see picture 5). That's why I could not call the Column direcly from the textBox outside the Gallery. 

 

But I found a temporary solution, by adding a button and do the "manual" calculation every time I come to this page. For the moment, an acceptable solution. 

View solution in original post

Power Apps Staff _Corey_
Power Apps Staff

Re: Sum of items in a dynamic Gallery

@MartinSun2000 I'm glad you were able to solve your problem! 

MartinSun2000
Level: Powered On

Re: Sum of items in a dynamic Gallery

But I just discovered that, the program actually worked before without this kind of problem. 

I tried to recover the program to a earlier version (about 5 days ago), it does not have the Fix I adde, but it worked from the begining, until I save it and publish it again, then it doesn't work. 

 

I also foudn that many of my other program that make the same call of Gallery.Allitems  all start to act strangely recently. (They do not seems to populate the function called, see attached picture 7). 

 

Is there a bug recently?!

Power Apps Staff _Corey_
Power Apps Staff

Re: Sum of items in a dynamic Gallery

Yes. A regression in gallery was inadvertently shipped. A hotfix has been validated and is approved for deployment. Once deployed, you will need to edit your app(s) in Studio and re-publish. I will update this thread once hotfix deployment is complete.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,817)