I want to increment the number in a text input by pressing the plus button😅,
I tried Set and UpdateContext in OnSelect but seems not work..
Better than the not visible button, you should use the DisplayMode property, with the formula:
If(Len(variable) <= 0;DisplayMode.Disabled;If(Int(variable) <= 0;DisplayMode.Disabled;DisplayMode.Edit))
If the input is a text input:
If(Len(Quantity_Input) <= 0;DisplayMode.Disabled;If(Int(Quantity_Input.Text) <= 0;DisplayMode.Disabled;DisplayMode.Edit))
For the text input formula to work, the input has to have the same name as the one in the formula.
Hope that this solution has helped you 👍
@joao_guerreiro Are you using any collection as datasource for gallery (in items property of gallery)? If yes, you can add one more property in collection which will store the number value.
It will act as a dynamic variable for each item in collection.
Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it 👍
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Hello @ganeshsanap thank you for your solution 😄
This worked in my gallery, the only problem I'm facing is that the variable is shared through everyline in the gallery, how do I assign a new variable with the same properties to every row that is added?
Thanks for your response.
I worked out how to hide button so thanks.
For the input field, as you can see if have the first box set as var1 so then next one needs to be var2 from your reply but you can't see how you edit that field as everything you do in the first container is pulled through to the rest when previewing? I'm obviously missing something.
Thanks
Ross
Hi Ross,
1) You can use the visible, or display mode property of the button based upon the variables value. I.e, when 0 you could hide the button.
2) For each input field you need to set the Text property to the name of your variable. You will need a separate variable for each input text.
Thanks
Kenny
Sorry, jumping on this post. I have created something similar.
Had a couple of questions.
1. How do I prevent the - button going below zero?
2. Also, how do I link input field to each product as when testing in preview it is increasing all values for each product.
Do I need to add ThisItem.Product in var1? just thinking out loud
Thanks
Ross
@Matt_Xiao Follow below steps:
1. Use below formula on onStart of App or onVisible of screen control:
Set( var1, 0 )
2. Set Default property of TextInput1 control to var1.
3. Set onSelect property of button control to:
Set( var1, var1 + 1)
Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it 👍
You need to delete that first line and then in the Default of the text box just set it to var1
Hi Kenny,
Thanks for your reply. Please see the screenshot below
you certainly have the right method so you must have an error somewhere.
for your input box, the default should be something like varNumber. Then on the onselect of the button you would have UpdateContext({varNumber: varNumber+1})
if this doesn’t work then maybe share what you have put.
thanks
MS.Ragavendar
32
Michael E. Gernaey
19
Super User 2025 Season 1
WarrenBelz
18
Most Valuable Professional