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!
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.
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):
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.
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.
Great! Thank you guys so much. I'm looking forward to getting this program up and running now.