web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set a control mechanis...
Power Apps
Answered

Set a control mechanism in input text within a gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone, i'm trying to fullfill the following requirement in powerapps. The user in the gallery can choose a type of product and the quantity associated, and the quantity choosed must be equal to a given value. In the case the user can select that type of product only one time the problem is quite trivial. However the user in the gallery can insert multiple rows of the same product and i have to ensure that the sum of such quantities must be equal to that number.

Let's make an example: i have the product 'Computer' with a given value of 20. In the case the user insert just one row of type computer the system must ensure that the quantity set by the user is extactly 20. In the case the user insert in the gallery, let's say 3 rows of type 'Computer', the sum of the three rows must be equal to 20, same for dfferent quantities. 

I was struggling a little bit trying to achieve this. Which kind of approach do you suggest me? Which properties of controllers can i exploit? 

I thought about a way to update dynamically a variable based on the values input by the user, such that when the value of the variable (composed by the sum of the quantity of the product of that type) do not match the desiderable value, the system gives an error, but i didn't make it.

Hope you understand my problem, thanks to everyone who'll help me.

Categories:
I have the same question (0)
  • Verified answer
    mmollet Profile Picture
    3,187 on at

    You can always sum items in a gallery like this:

    Sum(Gallery7.AllItems, If(FirstName = "Mike", num1))

    This will sum all items in the gallery that have a firstName value of "Mike" and will sum the num1 column. In this case I have 3 entries that add to 100 so this would display 100. 

     

    Here is another option that doesnt use a gallery:

    Sum(Filter(Test, FirstName = "Mike"), num1)

    This is not delegable so keep that in mind. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you, i was missing that syntax, and it works as i expected. Thank you again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard