InoDrive / UserApp / readVar


InoDrive.UserApp.readVar(argv)

Read Variable(s) value by Name or ID in User Application, polls Variable List

Arguments:

Argv (String), Argument can be a single Variable Name (String) or a ID (Integer). Can also be a List of Variable Name’s or ID’s.
Props (Object) Optional property argument to round up a floating point value to the nearest digit.

Returns: Variable Value (Boolean, Integer, Floating Point) Value of the variable named

// Import InoDrive API Library
import { InoDriveApiJS }  from "ck-inodrive-api" 

// Instatiate the API
let InoDriveApi = new InoDriveApiJS.InoDriveApi({ connectAppUrl: "", secure: false })

// Instantiate InoDrive Object
let Drive = await InoDriveApi.InoDrive({ target: "Name", autoConnect: true })

// Read Single Variable by Name
await Drive.readVar("TestVariable2")

// Or Read Multiple Variable’s by Array
console.log(await Drive.readVar([1, 2]))

// Reading floating point variable with value round up to the third digit
await Drive.readVar("floatVariable", { floatPrecision: 3 })