Jump to content
  • 4.3 - Default

    4.3 - Default

    VBScript

     

    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 Announcement
    Set Announcement     = new PersistentVariable
    Announcement.Name    = "Welcome"
    Announcement.Default = "Beep.wav"
     
    PlaySound Announcement.Value

     

    The above example defines a persistent variable with the name Welcome in the user scope of the current script user or in the group scrope of the current script group.

     

    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
     Share


     Share




×
×
  • 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.