LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array to cluster with adjustable cluster size

Hi falkpl

Then could you pls show me an example of how it works? thanks!!
0 Kudos
Message 21 of 27
(2,802 Views)
I was thinking about the "DB execute query" command and using a SQL
INSERT INTO table_name
VALUES (value1, value2,....)
command.  I have used this to get DB data sets I have not tried inserting but I find it easer to parse strings 
itterativly using a string concatination for the values inside a loop with a shift register than trying to 
deal with clusters which tend to have to be predefined.
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 22 of 27
(2,785 Views)
Ya, I know I can use SQL query to insert data but since my columns, data are not fix, so it's hard for me to insert... Can you pls give me an example of the SQL command?

What if some of the columns are empty? How to insert using SQL command.. ?? As I'm not good in SQL.. Smiley Sad
0 Kudos
Message 23 of 27
(2,771 Views)
Hi 222: INSERT SQL Statement: INSERT INTO < TABLE name> ( < COLUMN1> , < COLUMN2> , ... , < COLUMNX> ) VALUES ( < VALUE1> , < VALUE2> , ... , < VALUEX> ) if there are strings you'll need to put strings between ' and ', for example 'car' if there are dates, you'll need to convert the values, for example if your DB is SQL Server, CONVERT(DATETIME, '02/03/2006') if your DB is Access, #02/03/2006# Hope it helps, < TBODY>< /TBODY>< /TABLE>

Message Edited by Support on 03-02-2006 09:28 AM

Aitortxo.
0 Kudos
Message 24 of 27
(2,764 Views)
Since the columns must be defined in a database, and a record should have values for all columns you should define the value to be some default value, for a string this could be something as simple as "n/a", "unused"  or a simple blank for a number 0 or -1 can be used.  When you parse build the SQL string a case statements can determine wether the SQL string will set a value to a variable or to a constant default value.  I am also not a SQL expert but we all should become very familiar with the technology since it looks like future storage systems (ie winfs) will rely heavily on both SQL/database technology and XML.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 25 of 27
(2,754 Views)

I had need of dynamically variable size arrays of integers and was contemplating an approach just as you suggested, but your tip regarding converting to a variant was what I needed to actually implement it. FYI, we have a very high data rate application and we needed to develop a custom binary file format with configurable channel counts, etc. and with as little overhead as was feasible. We stored information about each channel with the data, so I needed to find a way of scaling the array sizes stored to match the number of channels configured. I used my channel count property as the control for a case statement that created my cluster (then variant) for each possible number of channels (1 through 16 in my case). On the other end, just as I needed to write the data to the file, I had another case statement and a Variant to Data that converted it back to its proper format before writing it in binary to the file (the File I/O operation was also in the case statement). Worked like a charm. Thanks for your tip, it probably shaved a day or two of effort off my work :).

0 Kudos
Message 26 of 27
(1,777 Views)

In case anyone is still having the same problem, I've attached an INSERT_NEW_ROW VI that accepts a string array as the new row value, adding each new value to the corresponding column of the database. Basicaly I've build the SQL statement to insert the new values.

Message 27 of 27
(1,178 Views)