1. How do I create and set values for Global Variables in OutSystems P10 (Mobile app).

What go you mean with global variables? Session? Site? Local?

I mean Session Variables.


On a mobile device you don't have a session. 


You can make a local database (or web) and store the value into it or pass it through in each screen/action.


Kind regards,

Evert



This seems like a work around with bad practice. It means I would have to make request to the database each time I need the variable. 

That's not a work around, thats mobile (-:


Local storage is quick enough I think.....

You can attempt to create a global javascript variable by creating a javascript that sets this.variablename, then another function to retrieve it.  However, I would caution you because I'm not sure about that type of variable being persistent when the app closes and reopens.  You would need some rigorous testing for your use case.

I would also advise you to use local storage.

If the values don't change, local storage sounds like overkill.


Just create a function GetGlobalVars that assign the constant values to a strucutre, then invoke GetGlobalVars().Structure.Value as needed.

Hello 

Check out the plugin Shared Preferences.

https://www.outsystems.com/forge/component-overview/4995/shared-preferences-plugin

 This plugin uses SharedPreferences on Android and NSUserDefaults on iOS.


HI,

Use the SHARED PREFERENCES Plugin available on forge that use native features like Shared Preferences & NSUserDefaults to store key values pairs on Android & iOS respectively. 

The One which we have published Shared Preferences Plugin if you would like to check this out. 

Just like we use the Shared-Preferences with native for storing local & permanent session or values across all screen, you can use this.

https://www.outsystems.com/forge/component-overview/5013/android-ios-shared-user-preferences

Cheers