LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

typedef

Solved!
Go to solution
I have a strict typedef that I use for startup configuration, it is a cluster that is full of clusters, and these clusters all
have strings and dbl indicators. When I change what is in the string or the value in the indicators it does not come through
in to the program. I thought a strict typedef would update the value in the typedef when used?

0 Kudos
Message 1 of 7
(3,739 Views)

*.ctl (strict or not) are dedicated to define the type (i.e play with some properties) and not the values.

 

It's a waited fact that if you change value in a *.ctl all is instance are not updated.

 

 

0 Kudos
Message 2 of 7
(3,736 Views)

When you say you change what is in a string, do you mean you are writing to it somewhere, or going into the control editor and changing the value? If the later, are you doing a "make current values default" before saving? It is a selection in the tool bar under "Edit"

 

If it is the former, programmatically writing a value to one instance of a typedef, strict or not, won't have it propagate throughout the program. Typedefs, as the previous writer mentions, are just that type definitions, which define a data structure, not the data within. But, if you put values into it while editing, then make them the default values before saving, then those values should be the default values everywhere you use the control. 

Message Edited by LV_Pro on 01-14-2010 12:08 PM
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 3 of 7
(3,735 Views)

LV_Pro wrote:
When you say you change what is in a string, do you mean you are writing to it somewhere, or going into the control editor and changing the value? If the later, are you doing a "make current values default" before saving? It is a selection in the tool bar under "Edit"

That will affect newly droped instance but one already on the diagram.

 

As I wrote in my Type Def Nugget you can not count on that the default values to propgate to the block diagram instances and ever worse, if you edit those instances to put in values when the type-def is edited, you can loose those values when LV goes through and deltes the old version and replaces it with the new version. The method I use for values that will never change or will only change at edit time is to use a sub-VI as shown in this image from that Nugget

 

 

 

or... if the data can change at run time, I read it from file and pack it into the cluster/control.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 7
(3,727 Views)
I only read the data. Its basically a ini file. I have the test parameters in there. I change the string and the values in the indicators, then I make current values default but when I run the program the values Are not always the same. I use type defs all the time but this is the first time I'm trying to use the values stored in them. I did copy it from a different program changed its name but its want to keep some of the older values when I run it. I checked every thing I can think of. Are type defs for data types or Are they also for the data in the data types?
0 Kudos
Message 5 of 7
(3,714 Views)
Solution
Accepted by topic author dksys2000@yahoo.com

Imagine a type def (strict or not) is a classical type as numeric for example.

 

You can use several numeric but you don't want that all numeric change if you change only one.

It's the same case for type def. Type def are only a mean to define a custom representation of data but not the content.

 

If you want propagate values between them, you must link them (control to indicator, to local variable, propoerty node, etc...)

Message 6 of 7
(3,704 Views)

What you are searching for is a method to get default values loaded into your type defs. There are many ways to do this. I'll guess that these two Nuggets may be a bit much but I'll share them in-case they give you some ideas that will work for you.

 

In My Nugget on Exploiting Control references I mentioned a number of ways of initializing data structures. I included some "out-there" code in that thread that demonstarates how to init from file and the inverse operation of writing it to file. THat example is based on an Action Engine design which alos may help you.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 7
(3,692 Views)