Hello,
I'm trying to create a very simple counter in PowerApps that looks like this:
Here's how I'd like it to work:
My Problems:
Thank you for your time!
Jason
Solved! Go to Solution.
You're already doing the right thing in initializing the counter:
Screen1.OnStart: Set(myCount, 0)
But you need to close and reopen the app (i.e., save it to your computer, then open it) to have the OnStart executed.
To test the value, you can use the If function in your buttons:
btnUp.OnSelect: If(myCount < 9, Set(myCount, myCount + 1)) btnDown.OnSelect: If(myCount > 0, Set(myCount, myCount - 1))
Another option is to keep the formula as is, but disable the buttons if they cannot be pressed. The properties would look something like those:
btnUp.OnSelect: Set(myCount, myCount + 1) btnDown.OnSelect: Set(myCount, myCount - 1) btnUp.DisplayMode: If(myCount < 9, DisplayMode.Edit, DisplayMode.Disabled) btnDown.DisplayMode: If(myCount > 0, DisplayMode.Edit, DisplayMode.Disabled)
You're already doing the right thing in initializing the counter:
Screen1.OnStart: Set(myCount, 0)
But you need to close and reopen the app (i.e., save it to your computer, then open it) to have the OnStart executed.
To test the value, you can use the If function in your buttons:
btnUp.OnSelect: If(myCount < 9, Set(myCount, myCount + 1)) btnDown.OnSelect: If(myCount > 0, Set(myCount, myCount - 1))
Another option is to keep the formula as is, but disable the buttons if they cannot be pressed. The properties would look something like those:
btnUp.OnSelect: Set(myCount, myCount + 1) btnDown.OnSelect: Set(myCount, myCount - 1) btnUp.DisplayMode: If(myCount < 9, DisplayMode.Edit, DisplayMode.Disabled) btnDown.DisplayMode: If(myCount > 0, DisplayMode.Edit, DisplayMode.Disabled)
Thanks for the solution, Carlos!
I used the DisplayMode approach. Here's what it looks like now:
At 9 btnUp is disabled
At 0 btnDown is disabled
User | Count |
---|---|
252 | |
107 | |
89 | |
51 | |
44 |