LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting data stream for database insert

This might seam like a rudimentary question, but what is the simplest way to prepare the data stream coming out of the DAQ Assistant so that it can be inserted into a database using the DB Tools Insert Data vi?  I am trying to stream one voltage channel from a CompactDAQ voltage card into a database and keep getting a type mismatch error from the DB VI.  When I set the table create to true, the function runs but inserts the text "Long binary data" of type "OLE Object" inserted into the rows of the database.  From the examples it looks like I need to use an array or a bundle but I'm not quite sure how to do this.
 
 
 
 
0 Kudos
Message 1 of 11
(3,833 Views)
Hi ControlAutomation,
you can tranform your "dynamic data" into an array of waveforms, or an array of double values. Transform these values into string, this should work to insert it into your database.

Hope it helps.
Mike
0 Kudos
Message 2 of 11
(3,811 Views)

Thanks Mike,

What function would I use to transform the output into an array of floats?  Would I use "build array"?  I'm not exactly sure what format the data stream coming out of the DAQ Assistant is.  I'm used to dynamically allocated and sized arrays in VB or C++.  All of the examples and tutorials I have looked at speak to fixed-sized arrays that are represented on the front panel.  Do you know of an example that takes the output from the DAQ Assistant and puts it into a database?

Mike V.

0 Kudos
Message 3 of 11
(3,804 Views)
Hi Mike V.,
this should work for you.
 
 
Mike
Message 4 of 11
(3,782 Views)

Forgive my Labview ignorance, Mike.  But could you indentify the functions in this bitmap?  Also, will this work with more than one channel coming out of one DAQ Assitant block or do I need to create one DAQ Assistant for each channel that I want logged?

 

Thanks,

Mike V.

0 Kudos
Message 5 of 11
(3,771 Views)
Hi Mike V.,
it´s possible with more than one channel, i confogured to channels. The first vi is the DAQ assistent, convert dynamic data, number to fractional string and then to variant.
 
Hope it helps.
Mike
Message 6 of 11
(3,767 Views)
Thanks Mike,
 
That is getting me closer.  What conversion type should I use for the "Convert From Dynamic Data" control?  Since I have four channels coming out of the DAQ assistant, I chose "2D Array of Scalars - Columns are Channels".  I still get one column of data in my database where each record in the table reads "Long Binary Data".
 
Any ideas?
0 Kudos
Message 7 of 11
(3,740 Views)
Hi Mike v.,
normally "2d Array..." should work. Please see the attached example.

Hope it helps.
Mike
0 Kudos
Message 8 of 11
(3,738 Views)
I tried the string conversion - same result in the database - "Long Binary Value".  The attached VI inserts the timestamp fine (Column 0) and then shows "Long Binary Data" for each of the four channels (Columns 1-4).  I must be missing something obvious.  Any further ideas?
0 Kudos
Message 9 of 11
(3,735 Views)

Hi Mike,

Thanks ! You have been most helpful !  I managed to get this working by splitting the DAQ Assistant output data stream into 4 channels, then converting each dynamic channel to a single scalar, then feeding each of these into an element of a bundle (with one node of the bundle coming from the real time clock) and then into the DB.Insert.  This worked, however insertion speed was limited to about 200-300 records per second.  This can't keep up with my 32KHz requirement so I have had to resort to using a TDMS file to buffer the incoming data.  Now I want to read the TDMS file back into the database.  I thought the output data stream from the TDMS read was the same as the DAQ Assistant output but when I perform the same conversions, my data is all zeros when it hits the database.  Any idea what I might be missing?

Thanks,

Mike V.

0 Kudos
Message 10 of 11
(3,714 Views)