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
Super User
Super User

Re: Increase Slider Value

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Increase Slider Value

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

jcr2007
Frequent Visitor

Re: Increase Slider Value

@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!!!

Highlighted
damilola79
Frequent Visitor

Re: Increase Slider Value

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

 

Helpful resources

Announcements
secondImage

Community User Group Member Badges

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

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

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