09-29-2011 09:44 AM
Hello,
I am taking data from SQL, I am getting multiple rows of data for many different devices. I would like to wire the data into a formula node so I can sepearate and sort via script. However, I am getting an error for "Polymorphic terminal cannot accept this data type". Is there a work around? Can I not wire in a string array to a formula node.
/r
Travo
09-29-2011 09:58 AM
Hi Travo,
maybe you should explain, why you want to sort using a formula node.
Does the usual Sort 1D Array function not work for you? (Do you know the trick to sort an array of clusters that is described here in the forum a lot of times?)
09-29-2011 10:03 AM
Hi GerdW,
I just started messing around with the index of clusters (but no, havent really seen the discussions). Basically, what I am trying to do; lets say I have three inputs a varchar type (string) which is a device name, a device time stamp and 3rd, a real number (double). each unique device has a set of rows for it own set of data (if there are 5 devices then there are 5 sets of data concatenated). Once I have the data in from the query (which is sorted by device,device time stamp) I would like to seperate out each data set so I can start crunching numbers for each individual device. I picked the formula node becuase I am familiar with scripting a bit more. Is there an easy way to do this?
Thanks for your quick response 🙂
09-29-2011 10:06 AM
Hi Travo,
yes, there is an easy way. It is shown in the context help of the Sort1DArray function (read the sentence on sorting clusters)!
09-29-2011 10:13 AM
Thanks, This is great, but it doesnt seperate out each data set. I can do the same thing via sql scirpt as "order by device,devicetimestamp" without the need for sorting the 1d array of clusters. Now, lets say that they are all sorted, how can I have it look for "distinct" devices and then parse out into seperate arrays similar to a search with a "where device = " clause
Nice trick though,
09-29-2011 10:23 AM
There are lots of basic string VIs that you can use to parse the string and separate out the individual fields. I would recommend "programming" your application using script nodes. Use the native language. LabVIEW is a fully functional and capable programming language.
09-30-2011 01:54 AM
09-30-2011 04:18 PM
Thank you both, I have found different ways of doing things. I figured that alot of what I was trying to do worked out well with a combination of SQL Procs and labview. I used the cluster array and for loops with case statements as well. I never did get the seperate arrays but figured out how to manage without the need for them.
Thanks,
Travo