LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dilemma with Datalog refnum with different data types

Hello all,

In an application, I have a worker thread which is basically writes to log file with datalog function. This thread stores datalog refnum in one of its shift registers. I will be using this worker thread (instances) to write different types of cluster data.

 

To open datalog file, I need to specifiy data type and I can't figure out how to do this. Putting types in Case structure doesn't work because the tunnel can only take one type wired to it. Putting types and Datalog open function in case structure doesn't work either because Datalog refnum is not a simple refum as it contains type specifics. So again the problem with tunnel type.

 

The only way I can get around this is writing flattened string to datalog file. This way the datalog function is typed as string. The draw back with this method is the possibility of data corruption when Labview version changes ( which may change flattened to string implementation)

 

Can you offer some suggestions ? Smiley Happy

0 Kudos
Message 1 of 3
(2,739 Views)

Hi zigbee,

 

The draw back with this method is the possibility of data corruption when Labview version changes ( which may change flattened to string implementation)

When NI changes internal representation of datatypes it will not only change the output of FlattenToString, but also the datalog format! So there is no difference between a "pure" datalog file and a file using flattened strings…

(I had this problem once somewhen between LV3 and LV6 - and never used datalog files again.)

 

When you want to handle your problem an OOP approach might work: you can have several objects of the same class working with with different data clusters (or use parent and child classes)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,727 Views)

Hi GerdW,


Thanks for your extremely quick reply and good info on datalog file format. so OOP is the only solution to the problem ? Smiley Sad

 

And writing flattened string vs writing variant to datalog, which one sounds better in your opinion ?  (speed, etc...)

 

 

0 Kudos
Message 3 of 3
(2,709 Views)