cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chrisegger
Helper III
Helper III

Anzahl Datensätze zählen

Hallo!
Im Anhang seht ihr einen Screen, in dem ich über die Eingabe eines Datums in der Suchzeile die Datensätze, die diesem Datum entsprechen, anzeigen lasse.
Im Textfeld im obersten Rand soll die Anzahl der gefilterten Datensätze stehen

DAs wollte ich mit 

CountRows(BrowseGallery1_1.AllItems)

machen, gibt aber nur einen Fehler aus!

Im rot eingekreisten Feld soll das Ergebnis von 4/Anzahl der gefilterten Datensätze stehen.

WEr kann helfen!!!!

Was mache ich falsch?

Unbenannt.png

3 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @chrisegger ,

Back to my earlier post - you will need a button or similar to trigger it

UpdateContext({varCount: CountRows(BrowseGallery1.AllItems)})

then your calculation in the gallery will be

Round(PizzaPriceField / varCount , 2)

 

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.

Visit my blog Practical Power Apps

 

View solution in original post

Thanks for your help, but I got the solution by my own. 
You helping me a lot, because I have to think over a lot of things.

chrisegger_0-1646515577044.png

I did it, like you say and now it works ..
Thanks a lot for your help

 

Greetings
Chris

View solution in original post

Hi @chrisegger , 

Select the form and anything else you need to copy and - Ctrl-C, then go to the other screen and Ctrl-V. 

View solution in original post

28 REPLIES 28
WarrenBelz
Super User
Super User

Hi @chrisegger ,

Where are you putting that formula - it needs to be outside the gallery.

IT is outside the gallery

@chrisegger ,

Then what errors are you getting - it should simply count the rows of the gallery. Bear in mind that if your gallery is filtered directly off a list, you will only get 100 records at a time as you scroll down.

chrisegger_0-1646290640220.png

im Textinput1 Feld soll die Zahl der aufgelisteten Datensätze durch die Formel CountRows(BrowseGallery1_1.AllItems)

stehen.

 

chrisegger_1-1646290821065.png

Im Labelfeld soll die Zahl 4 durch die Anzahl der ermittelten Datensätze dividiert werden und diese Zahl als Euro Betrag ausgegeben werden.

Im Labelfeld zum "Gesamtpreis:" sollen diese 2 Eurobeträge addiert werden.

Was läuft da falsch ....

 

@chrisegger ,

English please (I am from Australia). I responded to a question about counting the rows of a gallery - I am not sure how your latest response relates to that (maybe the Google Translate did not do good job.

OK WarrenBelz, and I'm from Austria 😀
So again my problem:
I wanna build a app for teacher in my school, wich want to order a pizza.
There is a delivery fee about 4 € and it should be divided to all people wich ordered a pizza, identified by the date.
So I got a filter by date. The Gallery will show all the people wich ordered that day. So I have to count the datas in the Gallery and divide.
But it doesnt work
When i got to know how many money each of the people have to pay the proportional delivery fee, I want to add it to the price of the pizza. So I  know how much each of them have to pay ...
Could you help me???

 

Thanks a lot and greetings to Australia

Hi @chrisegger ,

Your code

CountRows(BrowseGallery1_1.AllItems)

if placed in a control outside the gallery will return the number of rows in that gallery. It seems however that you are doing a calculation inside the gallery with the result (the .80 you have circled), which creates the circular reference I mentioned. You need a "calculate" button doing something like

UpdateContext({varCount:CountRows(BrowseGallery1.AllItems)})

then your calculation in the gallery will be

Round(PizzaPriceField / varCount , 2)

 

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.

Visit my blog Practical Power Apps

chrisegger
Helper III
Helper III

Sorry but this doesnt work!

So I changed the form a little bit!

The calculation of the delivery fee works fine

chrisegger_0-1646370868954.png

chrisegger_1-1646370981727.png

 

I did it with the formula:
Text(4/CountRows(BrowseGallery1_1.AllItems);"[$-de]#,00")

in Label14 outside the gallery

 

The "Summe Preis" in the gallery I did with:

Text(Sum(ThisItem.Pizzapreis;ThisItem.Getraenkepreis);"[$-de]#,00")& " €"

in label11 inside the gallery

 

but I can't add this two together in the gallery!
its tricky

 

 

 

HI @chrisegger ,

Back to the Circular Reference again . . . you cannot have a calculation inside the gallery dependent (even by a "chain" of other calculations) dependent on a variable attribute of the gallery (such as CountRows). You need to set a Variable to "break the chain" (as it becomes a static value until set again) and then base your calculation on the Variable.

 

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,686)