LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set default value of global

Solved!
Go to solution

I am following the steps outlined on the NI support page https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHw5CAG&l=en-US to set the default value of a global variable. A part of the diagram given on the page is shown below:

girish53_0-1694872097632.png

When I try step 8, the "Default Vals.Make Curr Default" option is not available in any of the menus/submenus. I am using Labview 2020. Is this available only in the newer versions? Is there any way to accomplish it in 2020? 

Thank you.

Girish Joglekar

 

0 Kudos
Message 1 of 8
(1,607 Views)

I see it in LabVIEW 2020. Did you enable scripting?

 

Can you show us the rest of your code, maybe attach it? (Of course the article does not mention globals. What exactly are you trying to achieve with all this?)

Message 2 of 8
(1,593 Views)

Yes, such an oddball request usually means that we should be asking "why" not "how".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 8
(1,562 Views)

Attached are setverpath.vi and verpath.vi which is a global. I want to set the string in verpath.vi to a desired value using setverpath.vi. The string in the verpath.vi is used by other vi's to get the path to the current version. In setverpath.vi will be executed once when creating a new version. 

BTW, 'enable scripting' did not make any difference.

Girish

Download All
0 Kudos
Message 4 of 8
(1,527 Views)
Solution
Accepted by topic author girish53

"Default Vals.Make Curr Default" is the short form of "Default Values -> Make Current Default". Ensure you have a method node (and not a property node), and ensure the reference class is "VI".

Message 5 of 8
(1,518 Views)

Thank you. That worked.

Girish

0 Kudos
Message 6 of 8
(1,514 Views)

I still would like to know the "why" because it seems we are just enabling bad coding that will lead to heartache down the road.  I can't think of why I would want to do this.  Well, that's not true.  I can think some reasons, but they are all bad.  Like setting a default and constantly overwriting current values with the default value, which is just asking for trouble.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 8
(1,498 Views)

@billko wrote:

I still would like to know the "why" because it seems we are just enabling bad coding that will lead to heartache down the road.  I can't think of why I would want to do this.  Well, that's not true.  I can think some reasons, but they are all bad.  Like setting a default and constantly overwriting current values with the default value, which is just asking for trouble.


I fully agree!

 

  • changing the default requires the control to be edited and saved, something that is not available in the runtime and thus needs to be done in the development environment, limiting deployment options.
  • You seem to want to create a folder based on the user home folder, which is already available here   and could be fully automated. No need for any globals.
  • Typically, local configurations should be stored in an ini file. Messing with source code branching is just asking for trouble!
  • It is a bad idea to operate on paths as strings. Using "build path" is significantly safer and OS independent.

 

altenbach_1-1694970677456.png

 

0 Kudos
Message 8 of 8
(1,478 Views)