cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

save user settings

You will see I have a tablet application in which I have 2 icons:

 

one of a moon

(dark mode)

 

one of a sun
(Clear mode)

 

I want to save the user configuration since the light mode will be by default but if you choose the dark mode I want that when you re-enter the application continue with the dark mode.

 

It would be great to be able to do it with a formula that I have read from the SaveData formula, but it doesn't work when I apply it maybe I don't apply it well.

If the solution is in a Sharepoint list, I prefer not to apply this.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: save user settings

@King 

My method will save the DarkMode settings to the device.

 

Put this code in the OnSelect property of your Moon icon 

 

ClearCollect(colUserSettings, {DarkMode: true});
SaveData(colUserSettings, "UserSettings");

 

Then, put this code in the OnSelect property of your Sun icon.

 

ClearCollect(colUserSettings, {DarkMode: false});
SaveData(colUserSettings, "UserSettings");

 

Finally, use this code in the app OnStart property.

 

LoadData(colUserSettings, "UserSettings");
Set(isDarkMode, LookUp(colUserSettings, First(colUserSettings).DarkMode);

 

Now you can check for DarkMode at any time by using the variable

 

isDarkMode

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

6 REPLIES 6
Highlighted
Community Champion
Community Champion

Re: save user settings

Create a Table OnStart of Your App (You can also use your Existing Table):
Set( UserTable7,
Table({ EmailAddress: "sss@aa.com", Name: "RR", PreferedColor: "ColorBlack"},
{ EmailAddress: "kss@aa.com", Name: "PP", PreferedColor: "ColorBlue" },
{EmailAddress: "uu@aa.com", Name: "LL7", PreferedColor: "ColorWhite"}
))
 
Then do a Variable OnVisible or Also OnStart of the App to lookup the User
prefered Color:in:
Set(VarMyColor,LookUp(UserTable7,EmailAddress=User().Email,PreferedColor))
 
Finally, in the Fill of the Form or Screen put:
VarMyColor
 
------------

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.
 
Highlighted
Super User
Super User

Re: save user settings

@King 

My method will save the DarkMode settings to the device.

 

Put this code in the OnSelect property of your Moon icon 

 

ClearCollect(colUserSettings, {DarkMode: true});
SaveData(colUserSettings, "UserSettings");

 

Then, put this code in the OnSelect property of your Sun icon.

 

ClearCollect(colUserSettings, {DarkMode: false});
SaveData(colUserSettings, "UserSettings");

 

Finally, use this code in the app OnStart property.

 

LoadData(colUserSettings, "UserSettings");
Set(isDarkMode, LookUp(colUserSettings, First(colUserSettings).DarkMode);

 

Now you can check for DarkMode at any time by using the variable

 

isDarkMode

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Helper IV
Helper IV

Re: save user settings

Hi @mdevaney  

 

thanks for answering I have applied what you indicated,

how can i use this in the fill property of controls.

 

 

Highlighted
Helper IV
Helper IV

Re: save user settings

hi @mdevaney 

 

it gives me the following error telling me that it cannot save data in the web browser

Highlighted
Super User
Super User

Re: save user settings

@King 
You can't save data in a web-browser.  SaveData and LoadData only work on a mobile device like a tablet.  I assumed this was OK because your question said you were making a tablet app.

 

There is no work-around for a PC/Laptop.  You must save this info to a datasource like SharePoint.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

Highlighted
Super User
Super User

Re: save user settings

@King

You can use it in the Fill property like this

If(isDarkMode=true, Black, White)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

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 (7,592)