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: 

Sub VI does not update when printing

Solved!
Go to solution

I am trying to print a report that I have created as a sub vi in my Main vi.  I have several inputs that are generated in the main vi that I want to put in to a custom report and then print.  Currently I have the report to be generated every time I pres the "p" key on the keyboard. A message will pop up and ask me if I want to print.  When I say yes, none of my inputs show up on the printed document - just a blank template. 

 

I attached a few screen shots to show the code.

 

Figure 1 is where I prompt the user to print and also send the inputs to an array to use in the sub vi

 

Figure 2 is the front panel of the sub vi    (this is where the inputs are not being updated!!)

 

Figure 3 is the block diagram of the sub vi

 

Any help would be much appreciated!

 

Marshall

Download All
0 Kudos
Message 1 of 10
(2,556 Views)

It sure would be a lot easier to help if you attached your code, instead of the pictures.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 2 of 10
(2,552 Views)

I wish I could but there is a lot of company sensitive information on the VI.  Are there any suggestions or other possible routes I could take with this issue?

0 Kudos
Message 3 of 10
(2,542 Views)

You don't need all of those index array functions.  If you take one and drag the bottom border downwards, you'll get multiple elements.  And by default they will be index 0, index 1, index 2, ......

 

 

Try to simplify your code to the bare minimum so it doesn't contain the proprietary information.  If you still have a problem, then attach that.

0 Kudos
Message 4 of 10
(2,528 Views)

Attached is a simplified VI that has no confidential information.  I made constant strings for the inputs.

 

Main.vi is the front panel

 

PrintReport.vi is the sub vi where the custom report is formatted

Download All
0 Kudos
Message 5 of 10
(2,519 Views)

Hi Marshman,

 

The VIs you provided work as I'd expect on my machine (LabVIEW 2013, in case it turns out it matters)- the printout contains the default information you specified. 

 

One thing I did change- the print function has a hard-coded path specified.  Is this the location you're running the VI from?  Is it possible there is another copy of the VI on disk?

 

In either case, I'd strongly recommend replacing the hard-coded path with a "Current VI's Path" primitive- it will save a lot of hassle down the line. 

 

Untitled.png

 

Regards,

Tom L.
0 Kudos
Message 6 of 10
(2,509 Views)

You are doing this way too complicated. You can delete all the print related stuff from the subVI, as well as the sequence structure, and simply set the VI to print every time the VI completes (vi options...print).

 

(Why are you using a hardwired path, the "current VI path" primitive would have been more reasonable. Still, you don't even need it)

Why do you have events for key up and key down? One is probably enough.

 

You also need to make sure the front panel is loaded into memory. In your case, the front panel is not loaded into memory, thus you get a printout with default values. LabVIEW does not update controls and indicators of VIs that don't have the panel loaded into memory.

0 Kudos
Message 7 of 10
(2,500 Views)

Altenbach,

 

Would you be able to modify the code and post it? It would be much appreciated.  I am not a very experienced programmer in labview.

 

Marshall

0 Kudos
Message 8 of 10
(2,492 Views)
Solution
Accepted by topic author Marshman

@Marshman wrote:

Would you be able to modify the code and post it? It would be much appreciated.  I am not a very experienced programmer in labview.


Here's the subVI set to print when complete.

 

(If it still does not work, configure it to open the front panel minimized when called and close afterwards)

0 Kudos
Message 9 of 10
(2,488 Views)

Altenbach,

 

That solved my issue. Thanks a ton. Saved me a lot of time.

 

Marshman

0 Kudos
Message 10 of 10
(2,482 Views)