LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String array into formula node

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

0 Kudos
Message 1 of 8
(3,234 Views)

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?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,227 Views)

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 🙂

0 Kudos
Message 3 of 8
(3,225 Views)

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)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,221 Views)

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,

0 Kudos
Message 5 of 8
(3,213 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 8
(3,209 Views)

Hi Travo,

 

"how can I have it look for "distinct" devices and then parse out into seperate arrays"

I would use a FOR loop with a CASE structure inside...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(3,193 Views)

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

0 Kudos
Message 8 of 8
(3,172 Views)