cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frans_365CH
Helper IV
Helper IV

set slider default with variable and show that value

Hi Colleagues, I've got a simple problem but I can't figure it out. I'd like the slider button to jump to the value given: 

//onchange

 

If(Slider1.Value <= 50;

UpdateContext({setSliderValue: 0});;

 

If(Slider1.Value >= 50;

UpdateContext({setSliderValue: 100])

)

)

 

Default = setSliderValue

ThankYou







 

10 REPLIES 10
eka24
Super User
Super User

Please give you explain further. Is the UpdateContext on a button and are you placing the value in a Textbox

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

ThankYou, This is the slider "Onchange" event:

 

If(Slider1.Value <= 50;

UpdateContext({setSliderValue: 0});

//do this....

If(Slider1.Value >= 50;

UpdateContext({setSliderValue: 100})

//do else...

)

)
And the "Default" of the slider is the variable: SetSliderValue

If i click on the slider on 30 or 60 the slider handler goes to 0 or 100, but if i drag the slider to 30 or 60, then nothing happens...
Looks like the "Onchange" event isn't working properly.

Thankyou so much for any idea





v-yutliu-msft
Community Support
Community Support

Hi @Frans_365CH ,

Do you want the slider value jump to 0 or 100 based on the selected value of the slider?

I suggest you add a reset function after you set variable in the slider's OnChange.

Try to set like this:

the slider's Default:

setSliderValue

the slider's OnChange:

If(Slider1.Value <= 50;

UpdateContext({setSliderValue: 0});

 

If(Slider1.Value >= 50;

UpdateContext({setSliderValue: 100})

)

);;Reset(Slider1)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It does work, but now he's bouncing in all directions, and that makes sense

🤣😂😅

Hi @Frans_365CH ,

So have your issue been solved?

If my solution works for you, could you mark my answer as solution?
Thanks!

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ola,
No sorry it does not work cos, the slider is bouncing in all directions, at the end it will go to 0 or 100 but with a lot of trouble.
Thanks.

Hi @Frans_365CH ,

Maybe you  could consider using a Timer to reset the slider to avoid the slider too quickly.

Try to set like this:

the slider's OnChange:

If(Slider1.Value <= 50;

UpdateContext({setSliderValue: 0});

 

If(Slider1.Value >= 50;

UpdateContext({setSliderValue: 100})

)

)

the slider's Default:

setSliderValue

Timer's settings:

AutoStart: true

Repeat: true

OnTimerEnd:

Reset(Slider1)

Duration:

1000

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I've thought about that too, but I'm making some kind of drag and drop. I don't think that would be a solution.

More idea's 😊

Which is a little weird:

If I drag the slider from 100 to 80, nothing happens.
If I drag the slider from 100 to 30 it jumps to 0.

 

And vice versa

 

If I drag the slider from 0 to 30, nothing happens.
If I drag the slider from 0 to 80 it jumps to 100.

 

The event does not work within 0-50 and 50-100.

 

Can you do anything with that?

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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