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.
Solved! Go to Solution.
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:
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,
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.
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.
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:
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,
User | Count |
---|---|
194 | |
126 | |
90 | |
48 | |
44 |
User | Count |
---|---|
280 | |
160 | |
138 | |
81 | |
76 |