From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

refactoring control definitions and propagating the change

Solved!
Go to solution

Hi

 

I created a control definition and used it in several places in my code.

I then refactored it by changing part of a cluster from a numeric to a string, this then broke the application because the change was not propagated through out the application.

 

If the change was automatically updated by labview in a similar fashion to the interactive find/replace method which visual studio uses then my change would not have broken my application.

Does lab view have a feature to aid refactoring?

 

Where are the vi's getting the definition for the old version of the control? is it stored in the vi itself? if so what is the purpose of using control definitions if we are not able to update the definition and have that change automatically propogated to places it is used in.

 

 

0 Kudos
Message 1 of 6
(2,315 Views)

Hi Jacob,

 

did you set your "control definition" to "type def" (or even "strict type def")?

 

This would propagate the change to all instances of that type definition...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,313 Views)

In addition, if you change the datatype of the type definition,  a lot of code might get broken because it is wired to functions that expect a different datatype. For example, if that numeric was wired to a numeric indicator, you cannot simply wire a string to it and expect it not to break.

 

Can you be a bit more specific what you are changing. Maybe attach a small example?

0 Kudos
Message 3 of 6
(2,307 Views)

Thanks to you both

 

I was not worried about the change in data type due to the polymorphic inputs on things like comparisons and array indexing primitives.

 

I did change the control to a strict def type and then to test the funcitonality I added another string to the structure. This extra string was not added in the places in the rest of the code where the type definition was used.

 

is this normal behaviour? I would have expected the extra string to be added to every reference to the control "strict type def".

0 Kudos
Message 4 of 6
(2,303 Views)
Solution
Accepted by topic author JacobM123

Hi Jacob,

 

did you create those other instances of the control from the (strict) typedefnition or did you create them from the (simple) control definition?

 

When created from type definition they will adapt to changes of that definition!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 6
(2,299 Views)

OK Thanks

 

I was not aware that I needed to press the apply changes button in addition to saving the type def.

 

thanks again for help with the basics 🙂

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