LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass a general datalog type to a subvi

I am writing a general subvi to determine if a file of a given name and optionally datalog type exists in a directory specified by the user. To match the datalog type I must be able to pass it into my subvi. To keep this question in a simple context, imagine putting the standard file/directory LIST vi inside a subvi. Now I want to pass the datalog type into this subvi so that this bit of code is generally useful. Is there a (preferrably easy) way?
 
I tried a variant control and it does not work - but does not generate an error either. It simply doesn't return any files. I also tried passing a cluster control refnum, but this failed for the same reason; when I wire the Value Property node it supplies a variant . . .
 
I am guessing that this job cannot be done with file/directory LIST since it checks the type of data wired to Datalog Type at program time. So if I take on the task of passing a type descriptor for a cluster/datalog type, how can I match this to the header of a datalog file? I see that most of the information matches, but not all . . .
 
Thanks,
 
Art Mihill
McPherson, Inc.
0 Kudos
Message 1 of 4
(2,616 Views)
Hello,
 
Well, you may be able to do this, but it may be easier to have a naming convention for your files, where you can determine immediately the datalog type from the file name.  One way you may attempt this is to read the file and use it's size, perhaps (mod) something (ie. look at the remainder after dividing by some integer) to determine the underlying datatypes.  You may also be able to parse the file and look for clues; in that case you may want to reference the following tutorial:
 
LabVIEW Data Storage:
 
 
If this isn't sufficient or not a viable solution, repost and we'll try to get a bit more creative!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 2 of 4
(2,595 Views)

Hi JLS,

 

Thanks for the ideas. They are definitely worth taking a look at.

I must admit that I am disappointed that this is something that cannot be handled in Labview. The datalog files seem to be only 2/3 functional. Since there is no other (code-free) way to use a simple data structure in Labview this is a real bummer.

Thanks again.

Art

0 Kudos
Message 3 of 4
(2,590 Views)
Hello,
 
Yes, I agree that it would be very convenient to be able to know immediately what the underlying LabVIEW datatype in a given file is.  However, the underlying datatype can be arbitrarily complex (in the case of a cluster for example).  Another idea would be to look at the header alone (a special case of the file parsing suggestion).  For example, it should be a 32 bit integer for arrays; using the header alone you may be able to distinguish between the types that you care about.
 
Please feel free to repost if you have trouble and we can continue to explore solutions, at least for your application, if not completely general!
 
Thanks,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 4 of 4
(2,581 Views)