LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert array of database variant to cluster?

Good point, Ben. I forgot you can't have nested types, so that would make it much simpler than the OpenG VI.

Basically, I believe that what you've posted is enough (although I don't think I would have a seperate query for each type. Instead, I would add the supported types into the query and ignore the unsupported types, or define them as binary). I still have a problem with the coupling you create with the DB structure, but I can see how people would want to automate this as much as possible. To get around that, maybe we can use a table name as part of the caption to allow selecting from different tables or maybe create a transalation table in the DB which will allow us to have constant names. I will play with this concept a little and see if I can come up with something useful.

BTW, I don't know if we can wire the variant directly into the Value property, because DB variants seem to be slightly different from LV variants. For example, if you attempt to convert an empty DB variant to an LV datatype, you will NOT get the default value if you use the standard Variant to Data function (at least in 7.0). This might not be an issue if we know that there will always be data there.
Another option - maybe convert from DB variant to variant and then use the property?


___________________
Try to take over the world!
Message 11 of 13
(3,771 Views)

I agree with all of your points tst.

And definately one query for all instead of one query per item.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 13
(3,755 Views)

Hello, 

 

DB for LabVIEW is a new Toolkit Compatible with LabVIEW that does exactly what you want.

It uses the LV Database and Connectivity Toolkit to connect your existing database, automatically get the database structure and columns data types. Then, with this information, it automatically generates a LabVIEW VI for your database, and this VI will returns your database records in clusters instead of variants.

There is also many other advantages using this DB for LabVIEW since it automatically gives you access into one VI, to all queries, all tables, and populates columns names for you.

 

You can try this toolkit by downloading it on http://studiobods.com/en/produits.html

It will also be available on the LabVIEW Tools Network in few days.

 



Matthias Baudot | Software Architect | Founder at STUDIO BODs


STUDIO BODs     BLT for LabVIEW     LabVIEW Champion     Certified Professional Instructor     DQMH Trusted Advisor     GCentral Sponsor


 Check out my LabVIEW presentations and videos!

0 Kudos
Message 13 of 13
(1,783 Views)