cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JukeNuke
Helper I
Helper I

Can only enter a QTY based on value of a data card

Currently working on a request form for my team. They search a part number and it displays the amount we have in stock. They then input the amount they want into a text label. How can I make it so that lets say there is a quantity of 100 in stock they are only able to request that amount and no more?

1 ACCEPTED SOLUTION

Accepted Solutions
JukeNuke
Helper I
Helper I

@mdevaney @Anonymous  Thank you for the quick replies!

 

Solved this by setting my visible property of my submit button to

 

!(Value(TextInput1.Text) > (Value(DataCardValue17.Text)))

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

You could set it's default to the max value then use an If statement in your submit button to reset to default if the input is above your max.

 

I'd probably do it something like this for the submit button

 

UpdateContext({max: "point to your max value here"});
If(TextInput > max, Reset(TextInput));

SubmitForm(Form)

 

Then set the default value of that textinput to max.  This assumes there will always be an input. You'll also need to make sure you're comparing numbers to numbers as far as data type goes.

mdevaney
Super User
Super User

@JukeNuke 

I assume the logic is the amount ordered cannot exceed the maximum amount less any items already in stock...

 

If(
    Value(TextInput_AmountOrdered.Text) > 
    (Value(DataCardValue_MaximumAmount.Text) - Value(DataCardValue_AmountInStock.Text)),
    true_condition,
    false_condition
)

 

If there is a submit button somewhere on the form you could disable it if when the condition is not passed.  Put this code in the DisplayMode property of the button.

 

If(
    Value(TextInput_AmountOrdered) > 
    (Value(DataCardValue_MaximumAmount.Text) - + Value(DataCardValue_AmountInStock)),
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

JukeNuke
Helper I
Helper I

@mdevaney @Anonymous  Thank you for the quick replies!

 

Solved this by setting my visible property of my submit button to

 

!(Value(TextInput1.Text) > (Value(DataCardValue17.Text)))

 

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,064)