LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DataBase toolset - interesting behaviour

Hello All
Did anybody try to inser a variant boundled in cluster to database using DB toolset?

I have it with another data boundled in the cluster and tried to insert it to DB. But I could not get any result out from it. I started to eliminate all other data, so I came only to the variant.
I found that DB will not insert it properly unless I wire a definition cluster like it is shown in the enclosed picture.
The funny thing is that nowhere in DB manual they request a definition cluster. But it will not work otherwise.

Pawel
0 Kudos
Message 1 of 5
(2,853 Views)
I'm wondering what exactly you want to store in the database. What datatype is the database field set to? I'm guessing it's a binary datatype and if that's the case, why not just wire the Array into a bundle function and then into the DBTools Insert Data VI? This will create one item in one record/field of the table. Is this what you want?

Here's another question - what exactly is inside that data array? It looked like an array of clusters. If so, then maybe you want each array element to be a record and the items in the cluster to be in separate fields? If so, I'd recommend doing something like in the attached picture.
0 Kudos
Message 2 of 5
(2,853 Views)
Hallo Crystal

Maybe I did not write it clear enough in previous post, but I have more data boundled in the cluster. I did not put them into the picture not to confuse.

The type of this field is binary and I need to store those data in one record. On your example, you will create every record for every array. That is not what I want.

My question was about the behaviour of DB toolset. When I wire a definision cluster it works, otherwise it does not. But I've already found a solution. First I need to use the DB variant to data casting to the LV variant. Afterwards I need to use LV variant to data casting to my type of data.

Thanks for the answer anyways.
regards
Pawel
0 Kudos
Message 3 of 5
(2,853 Views)
Pawel,

I can't give a complete answer to why the definition cluster is needed, I can only say that I think you are doing too many steps. I go back to my first paragraph and ask why you can't directly wire the Array to the bundle function? This should eliminate some steps in the reading of the data as well. You should only have to use the Database Variant to Data function to read back all the original data.
0 Kudos
Message 4 of 5
(2,853 Views)
Hi Crystal

>> "..why you can't directly wire the Array to the bundle function? "

I can not wire the array directly, because my measurement data are comming from many different sources and do not have the same definition. The definition of my measurement data depends on the current measurement. Sometimes it is a simple array of numbers, but sometimes it is three arrays and cluster, sometimes it is text data etc. therefore this field is means to be variant.

I have solved the problem, as I mentioned.

regards
Pawel
0 Kudos
Message 5 of 5
(2,853 Views)