05-03-2023 11:05 AM
Hello all, Newbie here. I have an 1D array of numbers that I am writing to a database and it works fine like this, each element goes in a column.
One problem is that data can change and have different columns, and I don't know how make a changing cluster into a type definition, or if that's possible. Do I need to? I need to add a timestamp to the cluster and tried this but the cluster data shape changes.
Is there a way to add a timestamp element to a 1D array that was converted to a cluster?
05-03-2023 11:08 AM
Clusters always have to be defined before your program runs.
You will likely have to switch to a database write VI that is more complicated where you define things more explicitly instead of just the simple "here's a cluster, write it for me" method.
05-03-2023 11:16 AM
So why can't you define it as a 2-D array and have the 1-D array data as one column?
05-03-2023 01:08 PM
Thanks for the response Kyle,
I am not very familiar with Labview, I just used the vi that is in the default(I'm assuming) database folder that came with labview 2023. Do you have any suggestions for an alternative? Is there one where I can create the table and define a DateTime field with the default value of system time? Then I won't have to send along a time stamp with the data.
05-03-2023 01:23 PM
Hi Bill,
Thanks for responding. I am not sure I understand your solution. I think that is what is happening now in the second snippet I posted, all the data from the 1D array goes into one column as a single long entry and the time stamp in another column.
I need each piece of data to be in its own column and the timestamp for the record as an additional column. There could be hundreds of columns and it could change at any time. When the column names change or the number of columns changes, the table name also changes and the new table is created as needed.
I could have the timestamp added as the first entry of the array, but it seems Labview won't allow an array to have different data types?
I am always trying to convert solutions from other languages and not sure what's possible in Labview.