cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AGS94
Resolver I
Resolver I

Co-Dependent Slider Controls

Is there way to make two or more sliders where their values are co-dependent? For example, let's say we have a maximum mix ratio of 20% such that "A" + "B" + "C" Max = 20%.

 

I would like it such that if the user were to set SliderA = 15% and then they start increasing SliderB, SliderA will remain at 15% until SliderB reaches a value greater than 5%, at which point SliderA will automatically start decreasing by each percent that is added to SliderB.

 

As mentioned, I would like this co-dependence to work across multiple sliders ("A", "B" and "C" in this case).

1 ACCEPTED SOLUTION

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi @AGS94 ,

 

I'd do it pretty much the way you described it 🙂

You may be limited by circular references though, so sliders will only update after a change, not during.

To keep it simple for an explanation, let's just use two sliders - Slider1 and Slider2.  We'll also only move slider1 up proportionately as slider2 moves past a certain value - you'll have to figure out what proportions you want to use, but this base logic should get you started.

Slider1 OnChange:

UpdateContext({slider1current: Slider1.Value})

Slider1 Default:

If(slider2current > 50, slider1current + (slider2current -slider1current))

Slider2 OnChange:

UpdateContext({slider2current: Slider2.Value});
Reset(Slider1)

Just repeat for additional sliders and alter the Default property formula according to the proportions you want the slider to change based on other slider values.

Hope this helps,

RT

View solution in original post

3 REPLIES 3
RusselThomas
Microsoft
Microsoft

Hi @AGS94 ,

 

I'd do it pretty much the way you described it 🙂

You may be limited by circular references though, so sliders will only update after a change, not during.

To keep it simple for an explanation, let's just use two sliders - Slider1 and Slider2.  We'll also only move slider1 up proportionately as slider2 moves past a certain value - you'll have to figure out what proportions you want to use, but this base logic should get you started.

Slider1 OnChange:

UpdateContext({slider1current: Slider1.Value})

Slider1 Default:

If(slider2current > 50, slider1current + (slider2current -slider1current))

Slider2 OnChange:

UpdateContext({slider2current: Slider2.Value});
Reset(Slider1)

Just repeat for additional sliders and alter the Default property formula according to the proportions you want the slider to change based on other slider values.

Hope this helps,

RT

View solution in original post

Hi,

 

I was able to create co-dependant sliders by using a timer - idea being that the timer checks the values while you are busy moving the slider instead of waiting for the Final OnChange. These timers are set that as soon as the two values are 20 or above, it slides the other down so that they remain at a max of 20 (you said 20% yeah?)

 

POC app is attached, hopefully you can make what you need by expanding on this concept.

Thanks to @RusselThomas for the initial concept, I built mine based off of that idea and then figured out how to make it live update.

 

Cheers,

ManCat

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


AGS94
Resolver I
Resolver I

 

Thanks to both of you!

 

RT: I was able to get yours to work.

 

ManCat: great idea - I will give that a shot!

 

For anyone else trying to make this happen, following is exactly what I ended up with (My "C" and "D" are RT's "1" and "2", respectively):

 

SliderC OnChange:

UpdateContext({ SldCCurrent : SldC.Value })

 

SliderC Default:

 

If(SldDCurrent > (SldC.Max-SldCCurrent), (SldC.Max -SldDCurrent),SldCCurrent)

 

 

SliderD OnChange:

UpdateContext({ SldDCurrent : SldD.Value });
Reset(SldC)

 

SliderD Default:

 

If(SldCCurrent > (SldC.Max-SldDCurrent), (SldC.Max -SldCCurrent),SldDCurrent)

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (22,351)