LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Datalog Set Number of records.vi Does not work on variable size type records

I've been trying to determine how I can edit a datalog record.

 

There are a few posts on this discussion board regarding this, and all of them recommend using  Set Number of Records to set the record count to 0 and overwrite the contents.

 

Unfortunately this ONLY works with consistent sized records, even if the types are the same.

 

The attached examples uses a simple open/replace, write, set number of records to zero, and close. A second file is initialized with the same file type and no written records, for comparison.

 

Steps:

Set valid file locations for your two datalog files.

1. Set the Type length to "constant length"

2. Set Type to "Integer"

3. Run the vi.

4. Open the resulting datalog files in notepad. Notice that the two files - the empty initialized datalog file and the file with the record count edited - are the same.

 

Repeat the above 4 steps using the "constant length" and "string" type option, and the "variable length" and "string" type option.

Notice that when writing a string of variable length, the resulting file includes a standard record header, and extra appended bytes! This is frustrating as the records I am writing include variable length arrays, clusters of integer and variable length strings, etc.

 

What's odd is that this data can still be read with no issue. You can even append data to the end! But if you were to read all contents from the "corrupted" file, set file size to zero, and write the contents back again, you'll see a steady increase in file size and visible data corruption. 

 

I tested this in Labview 2016. Can someone check using 2019? I can't make a bug report for 2016.

 

Using Labview 2022, Windows 10
0 Kudos
Message 1 of 1
(820 Views)