Skip to main content
Skip table of contents

5.4 - Conditional logging and the export set (Applies to T-Series and UD-Series)

Logging sets work well with normal logging and batch logging since they typically run for longer periods of time. If, however, you need to log only when certain criteria are met, then you will need to use an Export Set instead. Continuing our examples, let us have the system log our channels whenever the Pressure goes above 90.

1) Right click on EXPORT: in the Workspace and select Add Export Set. Call it OneLine.

2) When the export set area appears, enter a File Name, such as C:\mydata.csv

3) Click on the Fill w/ Chans button.

This button automatically fills the export set columns with each of your channels, setup to log the most recent reading only (notice the [0] after each expression in the table). This is the typical setup for conditional logging. Unlike logging sets, export sets can also log calculations and anything else you can describe in a DAQFactory Expression.

4) Click on the Details tab.

5) Select Fixed Interval, and then to the right under the Fixed Interval block, select Snapshot.

Fixed interval mode with Snapshot causes the export set to take a single snapshot of the current data irrespective of the time the data is acquired. This means that output channels, which are only updated in their history when they change values, will still appear on every logged data line. Since you only have one line, the Interval parameter does not apply.

6) Click Apply.

7) If not already expanded, click on the + next to CHANNELS: in the Workspace. Select the Pressure channel.

8) Click on the Event tab of the channel view. An event is script that is run whenever a new value arrives at the channel. Enter the following script:

if (Pressure[0] > 90)
beginexport(OneLine)
endif

9) Click Apply.

That is all that is needed. The event code looks at the most recent reading of Pressure and if its over 90, it will start the export set. The export set will then log a single line of data.

Sample file: LJGuideSamples\LogCondition.ctl

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.