Jump to content
  • 4.3 - Default

    4.3 - Default



    This property defines the default value of a persistent variable.


    When reading the content of a persistent variable it is possible that the variable has not been set before. In this case the configured default value will be returned.


    The default value takes up to 1kB (1024 Byte) of any data, like strings, booleans, numbers or dates. Data above the 1kB limit will be truncated.


    Dim MyVariable
    Set MyVariable     = new PersistentVariable
    MyVariable.Name    = "Welcome"
    MyVariable.Default = "Beep.wav"
    PlaySound MyVariable.Value


    The above example create a persistent variable Welcome in the user Scope (default scope) of the current user. Before accessing the content the default value Beep.wav is set.


    If at script runtime no other script has set the content of the variable before the default value will be used, i.e. a beep will be played in this example. Otherwise the previously stored content will be played.


    The default value will also be returned in case of any error accessing the database the persistent variables are stored in. If the Persistent Variables extension is properly installed no errors should happen, but you never know... Optional error handling will be discussed in LatestError and LatestDescription.



    Tom Wellige


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.