LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting-Terminal of a "Create from Data Type"

Solved!
Go to solution

I have a scripting function that is suppose to create a constant (think type cast or variant to data) from a provided sink. It then connects that constant to a designated terminal.

 

I'm getting this error when I try to grab the terminal of the object that I just created. (just before the error dialog that I placed)

scripting error.png

 

I've tried a handful of things and I have an assumption at the moment. LabVIEW handed me a constant with a control reference.

 

More specific errors out when I try to turn it into a constant. Guess that makes sense since it's not moving up or down the tree.

 

Did I use the "Create from Data Type" incorrectly? Is there a way to force the reference to still point at the object but be recognized as a constant?

 

Thanks,

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 1 of 6
(3,058 Views)

Doh, LabVIEW 2013

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 2 of 6
(3,031 Views)

Ok, I have a solution, but I'm not sure if it's correct, or robust.

 

More Generic to GObject

then

More Specific to Constant

Solution.png

So it works, but I'm not sure if the "Create from Data Type" method will suddenly create a control and throw my code into errors again.

 

 

I still think it's a little odd that it comes out as a Control when it could be a constant. Should this be a GObject reference?

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 3 of 6
(3,006 Views)
Solution
Accepted by JW-JnJ

This is a known bug with the Create from Data Type method. The prescribed workaround is exactly what you have done...cast the control reference to GObject, then cast that reference to Constant.

Message 4 of 6
(2,990 Views)

@Darren wrote:

This is a known bug with the Create from Data Type method. The prescribed workaround is exactly what you have done...cast the control reference to GObject, then cast that reference to Constant.


While we're on the topic, is it also known that the "Create from Data Type" method crashes my LabVIEW when done on a data variant from a TypeDef Enum control terminal?

 

(my searching is coming up blank... is there a place to search these?)

 

Thanks in advance

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 5 of 6
(2,974 Views)

I'm not aware of that issue. I recommend starting a new thread on the NI Forums giving steps to reproduce the crash, so one of the AEs can file a bug report.

0 Kudos
Message 6 of 6
(2,962 Views)