LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Variant To Data

I need help with the "Database Variant To Data" module from the database
connectivity toolkit. This module needs one input called type to split
the input data (variant) to an array. But i dont't know what's ment with
"type". If i create an constant i get an array but i don't know what to
put in. I have a database table with a datetime column an a integer
column. All i whant is to display the select in a simple labview table.
The onlinehelp gives very less help and i couldn't find more information
in the web.

thanks for each help,
Max
0 Kudos
Message 1 of 7
(5,362 Views)
The type input tells the function how to format the output. So, if you want
a string output, wire a string constant, such as a space, to the type input.
I haven't tried using the function on arrays, only single elements, so I
don't have any advice on wiring an array to the type input.

"Markus Manninger" wrote in message
news:3fff1bc7$1@e-post.inode.at...
> I need help with the "Database Variant To Data" module from the database
> connectivity toolkit. This module needs one input called type to split
> the input data (variant) to an array. But i dont't know what's ment with
> "type". If i create an constant i get an array but i don't know what to
> put in. I have a database table with a datetime column an a integer
> column. All i whant is to display the
select in a simple labview table.
> The onlinehelp gives very less help and i couldn't find more information
> in the web.
>
> thanks for each help,
> Max
>
0 Kudos
Message 2 of 7
(5,362 Views)
Look at my sample vi. The recordset obtained from the database is an array of variant. Wire the array to an Index Array function to get the element from the proper row and column. Wire that output to the Variant to Data function. Do this for each element in the variant array that you wish to retreive. My example shows a string as coming from the first database table column, and a number coming from the second column. I am using Oracle database, datetime is same as string, any number can be type cast as any numeric type (U32, I16, DBL, etc...)
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 7
(5,362 Views)
DD wrote:
> The type input tells the function how to format the output. So, if you want
> a string output, wire a string constant, such as a space, to the type input.
> I haven't tried using the function on arrays, only single elements, so I
> don't have any advice on wiring an array to the type input.
>

I know, but there is a difference between the "Database Variant To Data
" and the "Variant To Data". In the variant data stream there is more
then one value and they could have differnet types. In my case there is
just a datetime (I don't know how this type is called in LV) an a float
value. All I need is an example where i can enter an sql query and the
results will be shown in a table. I couldn't find such a example on the
ni code exchange webs
ite. Im using MSSQL Server.

Max
0 Kudos
Message 4 of 7
(5,362 Views)
I was refering to Database Variant to Data. Have you checked the examples
and recommendations for data conversion in the hardcopy manual?

> I know, but there is a difference between the "Database Variant To Data
> " and the "Variant To Data". In the variant data stream there is more
> then one value and they could have differnet types. In my case there is
> just a datetime (I don't know how this type is called in LV) an a float
> value. All I need is an example where i can enter an sql query and the
> results will be shown in a table. I couldn't find such a example on the
> ni code exchange website. Im using MSSQL Server.
>
> Max
>
0 Kudos
Message 5 of 7
(5,362 Views)
I thought that I had answered this question before. Maybe it didn't go through or maybe you didn't understand. See my attached example for solution. You must extract each element from the variant array and convert the variant data to whatever type you want. Convert datetime to a string.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(5,362 Views)
DD wrote:
> I was refering to Database Variant to Data. Have you checked the examples
> and recommendations for data conversion in the hardcopy manual?
>

I am now using an other subvi. I use "DB Tools Execute Query
" where i can enter a select string and then the "Fetch Table" vi to get
a 2D-Array data stream. I can directly connect it to a table.
0 Kudos
Message 7 of 7
(5,362 Views)