Variables need to be declared within the LMC first. See Add-Ins > Variables > + New variable. Also, they can only be used readonly, i.e. you can not modify them from within the script.

Variable values can be used using the object context.vars:

 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
exports.main = function (config, context) {
    if (context.vars.deviceName) { // checks if the variable is set
        context.setScalarByOid("1.2.1" /* /Setup/Name */, config.vars.deviceName);

The value of a variable that does not exist is undefined.

The value of an empty variable is "".

results matching ""

    No results matching ""