cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Preventing moving a higher quantity than what's available

Hey there!

I would like to know how I can hinder the overpacking of an item.

I have a data source consisting of a table with rows and values (right now an excel file in onedrive). This table holds two columns: "Item Numbers" and "Available Quantity". Each Item Number has an available quantity that must not be exceeded.

In my powerapp the user can select an "Item Number" from the data source in a combobox.
Hereafter the user can insert a number in a numberinput, based on how many the user wants to move of that selected item.
In some cases, the user will have to move a selected item number multiple times on the same screen. Therefore I have created a collection that sums up the moved quantity for the specific "Item Number".

However, I would like to prevent that the user can move a higher value than the "Available Quantity" for the selected "Item Number" in the summed collection.

 

Currently i can restrict the number input to not exceed the selected Itemnumber's available quantity by the following syntax:

 

If(Value(NumberInput1.Text) > ItemNumberCombo.Selected.'Available Quantity', DisplayMode.Disabled,Edit)

 

But this doesn't prevent the user from adding an additional quantity that exceeds the available quantity when going back to the screen from another screen as it's stored in the collection.

I'm looking forward to hearing your answers!

2 REPLIES 2
Highlighted
Impactful Individual
Impactful Individual

Re: Preventing moving a higher quantity than what's available

Do the check against your collection instead, using Max or Sum, or an equivalent function.

If ( ( Max( collection, column ) + Value( Input ) ) > #tocheck , Disabled, Edit )

Something like the above.
Highlighted
Advocate II
Advocate II

Re: Preventing moving a higher quantity than what's available

@GarethPrisk 
It doesn't seem like your suggestion will be sustainable, as there will be multiple item numbers in the collection.

I have tried the following:

 

If(Value(NumberInput1.Text) > ItemNumberCombo.Selected.'Available Quantity' - Sum(LookUp( Collection, ItemId = ItemNumberCombo.Selected.ItemNumber). MovedQuantity), DisplayMode.Disabled,Edit)

 


But it doesn't sum up the value of the ItemId's in the collection. Instead it takes the first MovedQuantity value for that particular item number

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,262)