cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frans_365CH
Advocate III
Advocate III

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,136)