cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ecrose24
Level: Powered On

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
Community Support Team
Community Support Team

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.
3 REPLIES 3
jhall
Level 8

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.

Community Support Team
Community Support Team

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.
Administrator
Administrator

Re: Slider Control resets on start

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

 

@TopShelf-MSFT 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 81 members 4,580 guests
Please welcome our newest community members: