LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting: get reference of the duplicate element

Solved!
Go to solution

In VI scripting I copy element (any type of indicator, control, constant) with Move method with duplicate property - true. The output top right terminal of the method is the reference to the source object, not the new one.

Is there any straightforward way to get reference to that copy (other copy method, etc)?

 

Not straightforward solutions (they may work on test examples, but not good)

1) move to temporary cluster - easy to find a new element

2) list all objects before, after and compare lists. But the source VI can be of any size and complexity.

3) Create element copy manually - bad, the solution should work on all kinds of elements.

0 Kudos
Message 1 of 5
(2,413 Views)
Solution
Accepted by topic author Alexander_Sobolev
I would use the VI method Create From Reference in this situation.
Message 2 of 5
(2,407 Views)

Good method.

It is almost working!

It can create controls and indicators, but fails with constants (Class conflict, when wiring constant reference to the Source Object Reference terminal)

 

Besides, there is a wrong description of the method (LV 2011):

LabVIEW help

Create from reference method:

Source Object Reference

A reference to the object you want to duplicate on the target VI. If you use this parameter, you do not need to wire the _type descriptor and style fields_.

There are no type descriptor and style fields at all, they are in other methods

 

Who is failing, me or LV? 😃

0 Kudos
Message 3 of 5
(2,392 Views)

Documentation errors in scripting are par for the course I am afraid.  I missed that you were doing constants, Create from Reference works with FP objects, despite what the help may say.  For constants you can use the Create From Datatype method of the BD.  

0 Kudos
Message 4 of 5
(2,378 Views)

Very strange method with incomplete documentation 😃 

And it does not copy an object - it creates absolutely new one. And in my case the constant type is not defined - it can be anything: cluster, typedef, etc.

Copying to the cluster (for constants) is an acceptable workaround, it works =). I'll wait till Create from reference is synchronized from it's help 😃

Darin, thanks for help.

0 Kudos
Message 5 of 5
(2,371 Views)