Example Code

Replace a Single Record Within A Datalog in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI will replace a record in your data log with a new record.

 

Description

You cannot write a record to any position except for the end of a Datalog. Using the "Set Datalog Position" function will only affect the "Read Datalog" function. In order to replace a single record within a Datalog, you must read all records from your Datalog, replace your record in the read data, delete all records on disk, and then write your modified records to the Datalog again.

 

The example program and its supporting type definitions are contained in the attached library file. You must modify the "Datalog.ctl" type definition to reflect your unique record structure for this subVI to work correctly! This will allow you to connect your record to the subVI terminals correctly. It will also modify the "DatalogRefnum.ctl" type definition such that the refnum you connect to the subVI from your other datalog functions will work correctly. You do not need to modify the "DatalogRefnum.ctl" type definition at all.

 

Requirements
LabVIEW Base Development System.

 

Steps to Implement or Execute Code
1. Load the attached VI "Replace Datalog LV 2012 - NI Verified" as a subVI.
2. Run as a SubVI

 

Additional Information or References

 Snippet 3756.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.