cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Slider Control resets on start

Hello, I fell like this is very simple but I cannot seem to find an answer.

 

I have an app that is keeping track of equipment inventory and I would like to add a slider to easily mark the fuel level while in gallery mode. Everything works fine, except when ever I exit the app and come back all the sliders reset to the default value. How do I keepthe sliders fro resetting on app start up?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Slider Control resets on start

Hi @ecrose24 ,

Could you please share a bit more about your scenario?

Do you want the Slider control to remain the previous value you set within your app without reseting to default value?

 

It is a normal behaviour with controls within a PowerApps app. When you string up an app, all controls within the app would be reset to the Default value.

 

If you want the Slider control to remain the previous value you set within your app without resetting to default value, you need to store the Slider value into a data source. Then when you re-start your app, retrieve the last stored Slider value from the data source, then set the Default property of the Slider control to the retrieved value.

 

I have made a test on my side, please take a try with the following workaround:

1. You need to create a data source (e.g. a SP List) to store the Slider value. The data structure of the data source should look like below:3.JPG

2. Within your app, set the OnStart property of the App control to following:

Set(PreviousStoredValue, Last('YourSPList').SliderValue)

Set the Default property of the Slider control (Slider1) to following:

If(
   !IsBlank(PreviousStoredValue),
   PreviousStoredValue,
   50
)

set the Onchange property of the Slider control to following:

If(
IsBlank(LookUp('YourSPList', Title = Text(Today(), "mm/dd/yyyy"))),
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: Text(Today(), "mm/dd/yyyy"),
SliderValue: Slider1.Value
}
),
Patch(
'YourSPList',
LookUp('YourSPList', Title = Text(Today(), "mm/dd/yyyy")),
{
SilderValue: Slider1.Value
}
)
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

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

View solution in original post

3 REPLIES 3
Continued Contributor
Continued Contributor

Re: Slider Control resets on start

You need to be setting the Default value for the slider and reading that value from "somewhere" that you saved it from the last session.

image.png

Basically, set the Default value above equal to a variable that you are reading out of some storage location during the App | OnStart event (e.g. Set(gSlider1Default,LookUp(myDefaults,Control="Slider1")).  You can just replace the italics portion w/ your own DataSource and matching criteria. 

You will still need to save those values (likely during the OnChange event for the Slider) so you can later retrieve them.

Highlighted
Community Support
Community Support

Re: Slider Control resets on start

Hi @ecrose24 ,

Could you please share a bit more about your scenario?

Do you want the Slider control to remain the previous value you set within your app without reseting to default value?

 

It is a normal behaviour with controls within a PowerApps app. When you string up an app, all controls within the app would be reset to the Default value.

 

If you want the Slider control to remain the previous value you set within your app without resetting to default value, you need to store the Slider value into a data source. Then when you re-start your app, retrieve the last stored Slider value from the data source, then set the Default property of the Slider control to the retrieved value.

 

I have made a test on my side, please take a try with the following workaround:

1. You need to create a data source (e.g. a SP List) to store the Slider value. The data structure of the data source should look like below:3.JPG

2. Within your app, set the OnStart property of the App control to following:

Set(PreviousStoredValue, Last('YourSPList').SliderValue)

Set the Default property of the Slider control (Slider1) to following:

If(
   !IsBlank(PreviousStoredValue),
   PreviousStoredValue,
   50
)

set the Onchange property of the Slider control to following:

If(
IsBlank(LookUp('YourSPList', Title = Text(Today(), "mm/dd/yyyy"))),
Patch(
'YourSPList',
Defaults('YourSPList'),
{
Title: Text(Today(), "mm/dd/yyyy"),
SliderValue: Slider1.Value
}
),
Patch(
'YourSPList',
LookUp('YourSPList', Title = Text(Today(), "mm/dd/yyyy")),
{
SilderValue: Slider1.Value
}
)
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

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

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Slider Control resets on start

Hi @ecrose24 how are you progressing with this? Were the above replies helpful?

 

@TopShelf-MSFT 

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,027)