cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jcr2007
Frequent Visitor

Increase Slider Value

Hi all,

 

I have one slider that has buttons on both sides, a minus "-" and plus "+". When users select the + button, I would like for the value of the slider to increase by one, and when a user selects the minus, decrease by one. It is a bit of a simple concept, but I am lost on how to execute. Any ideas I would greatly appreciate in advance. Thank you!

 

-JC

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@jcr2007 

You will want to set the Default property of your Slider to a variable.  Let's say sliderValue

Then, for the increment button, set the OnSelect formula to UpdateContext({sliderValue: SliderValue + 1})

And for the decrement button, set the OnSelect formula to UpdateContext({sliderValue:  SliderValue -1})

 

This should give you what you are looking for.  One aspect to consider adding as well would be a check against the min and max of the slider control.

In that case, I would add to the DisplayMode property of the increment button the following formula:

  If(sliderValue >= yourSliderControl.Max, Disabled, Edit)

And for the decrement button DisplayMode property:

  If(sliderValue <= yourSliderControl.Mix, Disabled, Edit)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@jcr2007 

You will want to set the Default property of your Slider to a variable.  Let's say sliderValue

Then, for the increment button, set the OnSelect formula to UpdateContext({sliderValue: SliderValue + 1})

And for the decrement button, set the OnSelect formula to UpdateContext({sliderValue:  SliderValue -1})

 

This should give you what you are looking for.  One aspect to consider adding as well would be a check against the min and max of the slider control.

In that case, I would add to the DisplayMode property of the increment button the following formula:

  If(sliderValue >= yourSliderControl.Max, Disabled, Edit)

And for the decrement button DisplayMode property:

  If(sliderValue <= yourSliderControl.Mix, Disabled, Edit)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes You are the real MVP!!!!! I should also note that my slider OnChange had to be adjusted so that the global variable will update when a user slides the handle. Thank you!!!

It increase and decrease all the gallery items quantity at the same time, is there a way to make it 1 item at a time

 

What did you adjust the Slider OnChange to be?

Is it possible to perform such a function if the slider is associated with a global variable?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,602)