Jump to content

Database Toolkit Variants VS Ordinary LabView Variants


Recommended Posts

Hi to all,

I'm writing an application that use an MS Access database to store test report data...

The queries to the database tables and colums are made using the NI Database toolkit.

This library returns the data into 2D array of variants, so i've made a VI that try to convert this array (line by line aka record by record) into

an 1D array of clusters representing one record each.

To do this I'm using the "Variant to Data" node, passing the 1D array of variants as input and specifing the cluster as target type...

Well... If I create the 1D array of variants assembling data from controls, the node successfully convert it into the cluster required...

If I connect as input the 1D array returned by the Database toolkit, the output cluster results empty!

Debbugging the code with probes, I've noted that the data types reported in the variants generated by the toolkit differs from the

data types reported for the standard labview types!

For example: A column defined as LONG (32 bit integer) in the database file, in the variant returned by the toolkit appear as VT_I4 instead of I32 or U32...

Anyone know why this difference?

There is a simple metod to automatically convert from the Toolkit type into the standar type variants?

I've also try to use the "variant to flattened string" node, but seems that this node does not work whit this kind of variants...

Thanks!

Osvaldo

Link to comment

For example: A column defined as LONG (32 bit integer) in the database file, in the variant returned by the toolkit appear as VT_I4 instead of I32 or U32...

Anyone know why this difference?

There is a simple metod to automatically convert from the Toolkit type into the standar type variants?

The difference is that the VT_I4 type is an OLE Variant type while the other is a LabVIEW Variant. The Variant to Data used to be able to convert both types but chocked on the VT_NULL Variant that could be returned. For that there was a Database Variant to Data function. It's possible that LabVIEW 8.6 or something changed this behavior so that you do need to explicitly use the Database Variant to Data function from the Database Toolkit palette for all Database Toolkit variants.

Link to comment

The difference is that the VT_I4 type is an OLE Variant type while the other is a LabVIEW Variant. The Variant to Data used to be able to convert both types but chocked on the VT_NULL Variant that could be returned. For that there was a Database Variant to Data function. It's possible that LabVIEW 8.6 or something changed this behavior so that you do need to explicitly use the Database Variant to Data function from the Database Toolkit palette for all Database Toolkit variants.

Thanks!

Can you retrieve the Type Descriptor of these OLE Variant Types using the Variant To Flattened String function?:frusty:

I would like to directly convert a variant array in a given cluster type, as with the original LabView Variant to Data function do.

I was unable to convert the array into a cluster directly using the Database Toolkit palette version function... it seems not to handle the aggregate types ...:angry:

If it were possible to get the type with the type descriptor, I could dismantle the array and rebuild the cluster using the same technique used in OpenG toolkit ...

Osvaldo

Link to comment

Thanks!

Can you retrieve the Type Descriptor of these OLE Variant Types using the Variant To Flattened String function?:frusty:

I would like to directly convert a variant array in a given cluster type, as with the original LabView Variant to Data function do.

I was unable to convert the array into a cluster directly using the Database Toolkit palette version function... it seems not to handle the aggregate types ...:angry:

If it were possible to get the type with the type descriptor, I could dismantle the array and rebuild the cluster using the same technique used in OpenG toolkit ...

Osvaldo

I'm afraid the OLE Variants, which the Database Variants really are, do not map 1:1 to the LabVIEW type descriptor definitions so it is very likely that this is not possible. On the other hand the Database toolkit used to have support for parametrized updates and queries so there should be some way, but maybe that got discontinued in the later LabVIEW versions as it was a seldom used feature and likely a pain to support too.

Link to comment

I'm afraid the OLE Variants, which the Database Variants really are, do not map 1:1 to the LabVIEW type descriptor definitions so it is very likely that this is not possible. On the other hand the Database toolkit used to have support for parametrized updates and queries so there should be some way, but maybe that got discontinued in the later LabVIEW versions as it was a seldom used feature and likely a pain to support too.

Ok! Thanks for all!

Have a nice day!:yes:

Osvaldo

Link to comment

But you should be still able to do what you want by using the DB Tools List Columns.vi to get the column name and datatypes of the query result and according to that info put everything properly into your cluster.

Oh! This is an idea!:thumbup1:

I never thought of!:oops:

Thanks!

Osvaldo

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.