LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get actual type from type enum

Solved!
Go to solution

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.

get cluster labels and types.png

 

Actor Framework
0 Kudos
Message 1 of 12
(2,212 Views)

@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.

get cluster labels and types.png

 


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.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 12
(2,193 Views)

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.

 

https://forums.ni.com/t5/Example-Code/Read-and-Write-array-of-Cluster-to-TDMS-Get-Set-Cluster-and-En...

 

I added this to my Tremendous TDMS Toolkit which is available on VIPM.IO

 

https://www.vipm.io/package/hooovahh_tremendous_tdms/

0 Kudos
Message 3 of 12
(2,182 Views)

@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.

get cluster labels and types.png

 


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.

 

 

Actor Framework
0 Kudos
Message 4 of 12
(2,162 Views)

@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.

get cluster labels and types.png

 


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".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 12
(2,149 Views)

@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.

get cluster labels and types.png

 


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:

paul_cardinale_0-1671546953868.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 12
(2,132 Views)

This looks interesting, but I it seems like I can't drag it into my Block Diagram. Could upload this as a VI?

Actor Framework
0 Kudos
Message 7 of 12
(2,111 Views)

@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"

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 12
(2,102 Views)

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.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 12
(2,098 Views)
Solution
Accepted by topic author Quiztus2

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. 

write cluster to tdms and read back.png

 

 

Actor Framework
0 Kudos
Message 10 of 12
(2,059 Views)