12-20-2022 07:05 AM - edited 12-20-2022 07:06 AM
I try to write and read back TDMS properties that come originally from a cluster of settings of different types. I saw a solution incorporating xml that look promising.
Nevertheless I would like to figure out how to cast the type enum to an actual type, which get properties can handle. I know one could build a case structure with all accepted types but I am sure that there is a more convenient way to get this approach working.
Solved! Go to Solution.
12-20-2022 07:37 AM
@Quiztus2 wrote:
I try to write and read back TDMS properties that come originally from a cluster of settings of different types. I saw a solution incorporating xml that look promising.
Nevertheless I would like to figure out how to cast the type enum to an actual type, which get properties can handle. I know one could build a case structure with all accepted types but I am sure that there is a more convenient way to get this approach working.
I have no idea what you are trying to accomplish. You want to change an enum to an "actual type", but an enum is an actual type. Describe what result you want.
12-20-2022 07:51 AM
If you are trying to read and write a cluster to TDMS channels or properties, you can use code I posted here which uses VIMs.
I added this to my Tremendous TDMS Toolkit which is available on VIPM.IO
https://www.vipm.io/package/hooovahh_tremendous_tdms/
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-20-2022 08:06 AM
@paul_cardinale wrote:
@Quiztus2 wrote:
I try to write and read back TDMS properties that come originally from a cluster of settings of different types. I saw a solution incorporating xml that look promising.
Nevertheless I would like to figure out how to cast the type enum to an actual type, which get properties can handle. I know one could build a case structure with all accepted types but I am sure that there is a more convenient way to get this approach working.
I have no idea what you are trying to accomplish. You want to change an enum to an "actual type", but an enum is an actual type. Describe what result you want.
The enum is a mapping between integers and strings e.g. 0-> invalid type, 0-> string, 1->U8 etc. Since the enum is from an official NI VI called Get Type Information.vi it is reasonable to assume that labview, this expensive mature masterpiece, holds something built in, which maps this enum to the actual type. E.g. 0->Empty String Constant.
12-20-2022 08:22 AM
@Quiztus2 wrote:
@paul_cardinale wrote:
@Quiztus2 wrote:
I try to write and read back TDMS properties that come originally from a cluster of settings of different types. I saw a solution incorporating xml that look promising.
Nevertheless I would like to figure out how to cast the type enum to an actual type, which get properties can handle. I know one could build a case structure with all accepted types but I am sure that there is a more convenient way to get this approach working.
I have no idea what you are trying to accomplish. You want to change an enum to an "actual type", but an enum is an actual type. Describe what result you want.
The enum is a mapping between integers and strings e.g. 0-> invalid type, 0-> string, 1->U8 etc. Since the enum is from an official NI VI called Get Type Information.vi it is reasonable to assume that labview, this expensive mature masterpiece, holds something built in, which maps this enum to the actual type. E.g. 0->Empty String Constant.
I'm confused. As was mentioned, the enum is the type. What you describe sounds more like a "ring".
12-20-2022 08:36 AM
@Quiztus2 wrote:
@paul_cardinale wrote:
@Quiztus2 wrote:
I try to write and read back TDMS properties that come originally from a cluster of settings of different types. I saw a solution incorporating xml that look promising.
Nevertheless I would like to figure out how to cast the type enum to an actual type, which get properties can handle. I know one could build a case structure with all accepted types but I am sure that there is a more convenient way to get this approach working.
I have no idea what you are trying to accomplish. You want to change an enum to an "actual type", but an enum is an actual type. Describe what result you want.
The enum is a mapping between integers and strings e.g. 0-> invalid type, 0-> string, 1->U8 etc. Since the enum is from an official NI VI called Get Type Information.vi it is reasonable to assume that labview, this expensive mature masterpiece, holds something built in, which maps this enum to the actual type. E.g. 0->Empty String Constant.
Now I understand. The answer is that there's nothing built-in to to that. Of course you could write code to do it.
But I think you would be better served by using this:
12-20-2022 09:58 AM
This looks interesting, but I it seems like I can't drag it into my Block Diagram. Could upload this as a VI?
12-20-2022 10:10 AM
@Quiztus2 wrote:
This looks interesting, but I it seems like I can't drag it into my Block Diagram. Could upload this as a VI?
Menu → Tools → Options ...
Select Category: VI Server
Under VI Scripting, check both items.
Click OK.
On a block diagram, drop an invoke node.
Wire it to a VI reference.
Select method "Create from Data Type"
12-20-2022 10:27 AM
If you're trying to do what i think you're trying to do, the Variant data type needs to connect to a Case structure and you'll have 1 case/data type with a fitting constant connected to the get property.
12-21-2022 09:05 AM
this is actually what I don't like. These Case Structures with types in it are not very readable. Since I had no luck importing the Scripting VI I elaborated further on this and came up with this working solution.