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: 

Pre-build vi to set a global

Solved!
Go to solution

Dear all,

 

I try to have te following action in my pre-build.vi. I have created a global boolean inside the project that enables/disables the watermark option for my report. This watermark has to be applied as long as the generated executable is in test fase so that it is clear that the reports created with this version are not official. Now I have created a pre-build.vi that let's me switch the global. However the watermark is not applied even though I set the global to true in the pre-build.vi

I'm clearly doing something wrong but I don't know how to solve this.

Your help is appreciated.

 

Regards,

Jeroen

Message 1 of 12
(3,608 Views)

Hello Jeroen,

 

For the debugging it will be useful if you provide the VI, or some more details, as there is no enough information to understand how you are using the pre-build.vi.

 

Thanks,

Arev

 

CTO | RAFA Solutions

 

Certified-LabVIEW-Embedded-Systems-Developer_rgb.jpgCertified-LabVIEW-Architect_rgb.jpg

0 Kudos
Message 2 of 12
(3,603 Views)

Hi Jeroen,

 

usually your executable should be in "test mode" (aka watermark) by default.

Only when the user provides a "key" (supplied by you) the software will switch off the watermark (and store the "key" for later use somewhere on the computer)…

 

No need to compile/install an executable twice!

 

(Hint: NI offers a toolkit for license management.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 12
(3,602 Views)

Hello Gerd,

 

A key is already needed, just to be able to run the program in the first place. I want some users to be able to test the program before making it final and release it to all users.

 

Hello Arev,

 

The code is not the issue. What I want is an option to select whether or not the executable I'm building is a final version or a test version. Where the test version will have the watermark applied to the report and the final version will not.

 

regards,

Jeroen

0 Kudos
Message 4 of 12
(3,591 Views)

Just writing the global will probably not be sufficient. You might have to make the current value default after writing to it, then save the global. I think the compiler makes internal copies of VIs which will have the default value saved on disk, not a value set in a VI in memory.

0 Kudos
Message 5 of 12
(3,577 Views)

Hi Jeroen,

 

A key is already needed, just to be able to run the program in the first place.

Use different keys for test and final!

(Again: license management…)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(3,573 Views)
Solution
Accepted by topic author JeroenBK

I do similar things with a version number of the build. I change the string constant in an FGV during bre-build:

image01.png

Don't mind that sub-vi, it changes the VI icon to reflect the version number.


Regards, Jens

Kudos are welcome...
Message 7 of 12
(3,571 Views)

What about using Project Conditional Diable Symbols? 

 

With a Global variable, you need to change the value, and save the Globals with the new value a the default value. 

Othervice the compiler just takes the code as it is and build the program. 

When you execute the Global starts with the default value. 

 

 

 

0 Kudos
Message 8 of 12
(3,550 Views)

Hello Together

I got an issue to define enum Variables in dependency to their build. What i wanted to setup different builds which whould change me the variable to the correct setup. Is there a solution to generate different pre-build VIs in order to change them? Like a compiler switch in C.

 

best regards

mazim

 

 

0 Kudos
Message 9 of 12
(3,122 Views)

Hi mazim,

 

you can create more than one BuildSpecification. Each BuildSpec can have its own pre-build VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(3,120 Views)