LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String array to cluster of strings?

Solved!
Go to solution

Hi,

 

I receive data from a database as a 1D array of strings which I'd like to convert to a cluster which only has string type elements. The umber of entries from the DB is always the same.

 

What is the reason that I can't even connect 1D strings and Cluster of strings to the typecast node and is there a way to convert the array to the cluster without getting the indexes of the array and bundle it to the cluster?

 

Thanks!

 

1984_0-1701353790647.png

 

0 Kudos
Message 1 of 5
(470 Views)

Why would you want to use a typecasting?

Isn't Array to Cluster enough?

ZYOng_0-1701354516209.png

 

0 Kudos
Message 2 of 5
(461 Views)

@ZYOng wrote:

Isn't Array to Cluster enough?

 

 


No, its not. If I just use the array to cluster then I can't unbundle by name.

0 Kudos
Message 3 of 5
(450 Views)
Solution
Accepted by 1984

If you want to keep the names of the cluster elements you could use 'Coerce to Type' in numeric -> conversion palette instead of 'Type Cast'.

See https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/coerce-to-type.html 

I don't know in which LabVIEW version this function came into the palette.

Coerce To Type.png

Message 4 of 5
(447 Views)

@1984 wrote:

 

 

1984_0-1701353790647.png

 


If you use Variant to Data or Coerce to type instead of type case it'll work.

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

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 5
(399 Views)