From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-09-2009 03:27 PM
Greetings all!
I need help creating a vi that is able to set the value of a control (using Ctrl Val.Set) within a cluster without prior knowledge of the cluster's data type.
More specifically, I have a cluster called "Test Setup", I don't know its datatype, but I do know that there is a control within the cluster called "Test Paramter" that i want to set. I really don't care about the rest of the cluster except for setting the value of that one particular element. i've tried various approachs to get this to work, but to no avail. Attached is some short code to better illustrate what i am trying to do. Thanks for the help!
04-09-2009 08:00 PM
04-10-2009 01:34 PM
I think I have an idea of what you are suggesting. I tried to implement this by first creating a variant indicator directly after using the invoke node (CTRL Val.Get). Once I try to convert the variant to a more specific class (cluster), I get the error code, ERROR 1057, type mismatch. I am not sure why this is happening. I've included some code and screenshots of my exact problem.
Thanks again!
04-10-2009 01:58 PM - edited 04-10-2009 01:59 PM
That wasn't quite what I meant. What I was referring to was doing the same thing you're doing on the right for the list of front panel controls of the VI that you are loading dynamically.
Normally this is what you would need to do .... unless you have the Variant library from OpenG. In this case it's much easier. So, head over to OpenG.org and get yourself VIPM and get the variant library. Then you only need to do this (using the "Set Cluster Element By Name" VI):
04-10-2009 02:11 PM
04-10-2009 02:20 PM
You can't take a control reference for a Variant control on the front panel and cast that to a Cluster control reference...those are two different types of controls. What you want to do is take the value of the variant and use the Variant To Data function to convert its value into a cluster of the desired type.
04-10-2009 02:31 PM
04-10-2009 02:40 PM - edited 04-10-2009 02:40 PM
04-10-2009 02:43 PM
In that case, you could probably use the VIs in vi.lib\utility\VariantDataType to get the types of controls within a cluster, find the one you want, and change its value (using GetClusterInfo.vi and SetClusterInfo.vi). I'm assuming these VIs function similarly to the afore-mentioned OpenG VIs.
04-10-2009 02:52 PM
Great! Thank you guys so much. I'm looking forward to getting this program up and running now.