I need to save a last value of a dropdown control and maintain the previous value as the dropdown control update to a new value.
Here is my meager attempt. But this doesn't work.
If(Not(varTargetLang = varLastTargetLang), Set(varLastTargetLang, varTargetLang))
The last value needs to be stored even when the app is closed and reopened. Thanks.
Solved! Go to Solution.
Hi @DonBo ,
Could you please share a bit more about your scenario?
Do you want to store the last selected value within the Dropdown box?
Based on the needs that you mentioned, I think the OnSelect property of the Dropdown box and a Collection could achieve your needs.
I have made a test on my side, please take a try with the following workaround:
Set the OnSelect property of the Dropdown box to following:
ClearCollect(LastSelectedValue, Dropdown1.Selected.Value)
the last selected value would be stored within the LastSelectedValue collection.
If you want to save your Last selected from the Dropdown box even when close or re-open your app, I think the SaveData function and LoadData function could achieve your needs.
Please set the OnSelect property of the Dropdown box to following:
ClearCollect(LastSelectedValue, Dropdown1.Selected.Value);
SaveData(LastSelectedValue,"LocalData")
Set the OnStart property of the App control to following:
LoadData(LastSelectedValue, "LocalData", true)
Note: You can't use SaveData and LoadData function inside a browser, either when authoring the app in PowerApps Studio or when running the app in the web player. To test your app, run it in PowerApps Mobile on an iPhone or Android device.
More details about SaveData function, and LoadData function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata
Please take a try with above solution, check if the issue is solved.
Best regards,
I don't know if this is the best way to do this but here is what I did when I had a similar problem. I created a collection and left the answer blank. Whenever there was a selection made, I patched the value into my collection. On my next page or submit or whatever, I set it to reset the value of that collection so it always returns to the default when you leave.
The only way around the close/reopen issue I can think of is SaveData and LoadData. You can use SaveData to save a copy of the data on your device locally and use LoadData to pull the last entry.
Note: The first time someone uses the app, there will be nothing to load so you will get an error message. This will go away after you save data for the first time.
Hi @DonBo ,
Could you please share a bit more about your scenario?
Do you want to store the last selected value within the Dropdown box?
Based on the needs that you mentioned, I think the OnSelect property of the Dropdown box and a Collection could achieve your needs.
I have made a test on my side, please take a try with the following workaround:
Set the OnSelect property of the Dropdown box to following:
ClearCollect(LastSelectedValue, Dropdown1.Selected.Value)
the last selected value would be stored within the LastSelectedValue collection.
If you want to save your Last selected from the Dropdown box even when close or re-open your app, I think the SaveData function and LoadData function could achieve your needs.
Please set the OnSelect property of the Dropdown box to following:
ClearCollect(LastSelectedValue, Dropdown1.Selected.Value);
SaveData(LastSelectedValue,"LocalData")
Set the OnStart property of the App control to following:
LoadData(LastSelectedValue, "LocalData", true)
Note: You can't use SaveData and LoadData function inside a browser, either when authoring the app in PowerApps Studio or when running the app in the web player. To test your app, run it in PowerApps Mobile on an iPhone or Android device.
More details about SaveData function, and LoadData function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-savedata-loaddata
Please take a try with above solution, check if the issue is solved.
Best regards,
User | Count |
---|---|
260 | |
123 | |
99 | |
48 | |
43 |