Please see the discrepancy between the formula bar evaluation of the formula and label text in the image below.
The CountRows should return 0 which is correctly shown in the formula bar evaluation (text returned is 'None 0') but is not showing correctly in the label (displayed text is 'None 2' - there were originally two items in the gallery but when they were removed, the text in the label did not update).
If I modify the formula (say, delete the end parenthesis and then add it in again) the label will then show the correct value, but changing the number of items in the underlying gallery does not update the value in the label. It appears formulas in controls are not recalculating automatically, only when they are forced by directly modifying the formula using the formula bar.
This is a common but intermittent fault (I have seen it many times in different Apps but it does not always occur).
Thanks @PaulD1 ,
I answered a post recently where a HTML box with elements based on a gallery value was not updating, even when the data source it contained was refreshed. This could be the reason (though not the solution)
Hi @PaulD1 ,
Do you mean that the Label control could not updated dynamically?
How do you remove the items from your Gallery? Using Remove function or remove items manually from your data source manually?
Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. The Label control displays correct value when I remove items from the Gallery.
Please consider refresh your data source using Refresh() function when you remove items from your canvas app. Then add a new Label in your app, try above formula again, check if the issue is solved.
In addition, as an fixed solution, you could also consider type the following formula after the Remove() function:
Remove(....);
Set(CurrentAmount, CountRows(galTheNewMilestone_scrnAddNewProject.AllItems)) // Save this value into a variable
then bind the variable to your Label control, check if the same issue still occurs.
Best regards,
Thanks @v-xida-msft
Yes, the label control is not updating dynamically.
I have seen this numerous times in Studio particularly as Apps get larger.
The Apps behave correctly in the Web Player but not in Preview mode in Studio. Closing/restarting Studio will usually resolve, but it is very annoying and causes wasted time as we investigate 'bugs' that turn out not to be in our code but in the way the Studio behaves.
In this case the gallery is based on a local collection and the Patch/Remove function is being used add/delete records.
The number of records was being used to determine if certain controls should be visible - when I saw this was not working correctly I added the CountRows to the text property of the label so I could see more clearly the result of the formula.
Hi @PaulD1 ,
Thanks for your feedback. Currently, I could not reproduce your issue on my side.
If you would like to get further help in this issue, please consider submit an assisted support ticket through the following link:
https://powerapps.microsoft.com/en-us/support/pro
Best regards,
User | Count |
---|---|
179 | |
113 | |
88 | |
44 | |
42 |
User | Count |
---|---|
225 | |
113 | |
112 | |
69 | |
67 |