LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reference Number in Goop

The reference number in Goop is TypedRefNum with an Enum type. How can I find the actual type inside the Data Log File Refnum shell programatically? For example, there are two reference numbers in the attached file, how could I tell which is which at run time?
My application of this is that I want to write generic codes that call identical methods in similar objects non-descriminately.
Thanks.
Thanks.
0 Kudos
Message 1 of 5
(2,481 Views)
Z,

Datatypes for refnums are incompatibles so if you want to make a subVI that accepts both types, you have to use a variant input. In the subVI, you discriminate the actual type by attempting a conversion from the variant to each expected typed refnums. See attachment.
Jean-Pierre


LabVIEW, C'est LabVIEW

Message 2 of 5
(2,481 Views)
Thank you Jean-Pierre,
It is precisely the answer I was looking for.
Zuolan
0 Kudos
Message 3 of 5
(2,481 Views)
Jean-Pierre,
Before I settle for a cumbersome/static solution, I need to make sure the following could not be done. In your example, refnums still need to be statically wired in the vi that desriminates the variant. The general questions is 'Is there any way to reconstruct those refnums without the hardwiring?'. For example, the 'flatten to string' function generates a 'type string' (the 23 element array). If the type string can be used to recover the refnums, then my solution would not have to be limited to the known types nor I have to make a case for each known type in my solution. Any thoughts?
Thanks.
0 Kudos
Message 4 of 5
(2,481 Views)
I have a fuzzy idea of what you are intending to do. You might want to use generic VIs to handle different reference types but at some place or some other place in your program you will have to differentiate what type you are actually handling to cast it properly and use it.
Obviously, using flattened data, you can't typecast it to its datatype if you don't know the datatype in the first place... e.g. you can't typecast the reference flattened data to a specific type without statically wiring to a known reference type.
The best you can do is illustrated in the attached VI. The VI accepts a refnum in its variant input. The type of object refnum is detemined parsing the type string. The type is used to determine which method VI to use,
set the value of its reference input and run the method VI.
I hope that helps.
Jean-Pierre


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 5
(2,481 Views)