LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Type defined array of clusters for holding configuration data - setting default values for each array element

Solved!
Go to solution

Hi,

 

I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.

 

The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  

 

I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?

 

I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.

 

To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.

0 Kudos
Message 1 of 5
(2,532 Views)
Solution
Accepted by topic author glstill

Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 5
(2,529 Views)

A much simpler way would be enter the configuration values to the cluster and convert the cluster to a constant or write the whole cluster to a .bin or datalog file they are easy to read and no once can read it manually.

-----

The best solution is the one you find it by yourself
Message 3 of 5
(2,518 Views)

Either way I strongly recommend against using constant values in the application. If anything changes for any reason you need to modify your application. File based changed are easy to make without having to modify the code.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 5
(2,515 Views)

@Mark_Yedinak wrote:

Either way I strongly recommend against using constant values in the application. If anything changes for any reason you need to modify your application. File based changed are easy to make without having to modify the code.


Yes I agree with that. saving the values will be the better option and also maintain a seperate vi (outside project to write the read the file).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 5
(2,510 Views)