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: 

Programmatically loading values of all front panel controls

I'm trying to save & load all my front panel values. Load is not working. What am I doing wrong?

0 Kudos
Message 1 of 31
(3,985 Views)

I see 2 things.

 

1.  You are feeding the value of the This VI reference into the Value input.  You are not putting in any of the values you saved to the file.

2.  You create a file that is an array of clusters of Name and Variant Data.  When you read the file and unflatten it, you wired in an array of clusters consisting of a string, integer array, and a string.  Your Flattens and Unflattens just don't match.

0 Kudos
Message 2 of 31
(3,956 Views)

Still not working!

0 Kudos
Message 3 of 31
(3,933 Views)

Here's a modified version following RavensFan's instructions.

SCIProject (1)_BD.png

In this case, I right clicked on the cluster wire coming out of the Ctrl Val.Get All node, and clicked Create > Constant. I then dragged the constant value to the second case structure, where I wired it to the type input of the Unflatten From String.

 

Now, you can see that the cluster array created has a Name and Variant Data, as you expect.

 

As a side note, rather than having a loop with a variety of different cases all being toggled on and off, I would suggest you take a look at the State Machine architecture.


GCentral
Message 4 of 31
(3,904 Views)

OpenG has a VI that does this for you.  It actually saves the data in a configuration file, making it so you can edit the data in a text editor if so desired.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 31
(3,890 Views)

Another suggestion for OpenG.  It is called Save panel to INI and Load panel from INI and the functions are on the Variant Configuration palette.  Super easy to use (just one VI each) and the output is a human readable text file.  It can be slow for lots of very large complicated data types (clusters of arrays of clusters of arrays) but for the quick and dirty it functions great.

0 Kudos
Message 6 of 31
(3,869 Views)

I downloaded both OpenG & MCI but for the life of me I can't get it working! So I tried to modify my code. Save is working but  Loadis not working! I'm LOST

0 Kudos
Message 7 of 31
(3,816 Views)

Your datatype you are flattening on the save is a string and a variant.  The datatype you wired for the unflatten in the load is a string, integer array, and another string.  They don't match.

 

You are writing those values to a Control Value Set node that is deprecated.  Pick that invoke node again for Ctr Val.Set.   You'll see it becomes a string and variant.  Now wire the correct datatype into the unflatten (create a constant from the wire that goes into the flatten above.  Fix the unbundle by name and everything should now be wired correctly.

 

Then try again.

0 Kudos
Message 8 of 31
(3,809 Views)
0 Kudos
Message 9 of 31
(3,805 Views)

@Canucks.canucks wrote:

I downloaded both OpenG & MCI but for the life of me I can't get it working!


Could you show us what you tried with those?  For OpenG, all you need are the Read Panel From INI and the Write Panel To INI VIs.  Those two will do everything for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 31
(3,796 Views)