Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 4 Expressions

4.10 Object Variables and Functions

Scroll Prev Top Next More

A DAQFactory document is made up of many different objects:  channels, sequences, components, pages, connections as well as internal objects like variables, email, file and system.  Most of these objects have variables that can be read or set, and functions that can be called to perform different tasks.  

The most common object variable is a channel.  By simply specifying a channel name, the current history of that channel is retrieved.  But channels have functions as well, such as ClearHistory.  To call the ClearHistory function of a particular channel, simply put a period (.) after the name of the channel, then enter ClearHistory():

 

MyChannel.ClearHistory()

Channels, however are actually objects contained in a connection.  Because of the default connection the connection name does not have to be specified, but this:

 

Local.MyChannel.ClearHistory()

is also completely valid.  Here we've specified the connection ("Local"), then put a period, then selected an object in Local ("MyChannel"), then a period, then a function of MyChannel ("ClearHistory()").

Most of the details of an objects variables and functions are described in the sections on the particular object.

If you are going to call one object's functions and access its variables often and don't want to have to type in the full name, you can use the using() function to put the object's functions and variables in the global namespace.  This will make it accessible without the prefixes.  The best use for this is when you are working with a particular device and need to call its functions.  So instead of:

 

Device.LabJackUD.AddRequest(...)

Device.LabJackUD.AddRequest(...)

Device.LabJackUD.GoOne(1)

Device.LabJackUD.GetResult(...)

Device.LabJackUD.GetResult(...)

you could do:

 

using("device.labjackUD")

AddRequest(...)

AddRequest(...)

GoOne(1)

GetResult(...)

GetResult(...)

Once you call using() with a prefix like above, it is added to a list and kept in the list as long as the document remains loaded.  You do not have to keep recalling this function and can simply put this in an auto-start sequence.  You can call using() multiple times with different prefixes to bring other functions and variables into the global namespace.  Just be careful as there may be collisions with existing function and variable names.

Note: if you do using("device.labjack"), DAQFactory will bring all the functions from both the LabJackUD device and the LabJackM device into the global namespace.  All LabjackM function start with "LJM_", so are easy to identify.