10-23-2013 01:42 PM
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
Solved! Go to Solution.
10-23-2013 01:47 PM
It sure would be a lot easier to help if you attached your code, instead of the pictures.
Cameron
10-23-2013 01:53 PM
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?
10-23-2013 02:13 PM
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.
10-23-2013 02:51 PM
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
10-23-2013 03:01 PM
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.
Regards,
10-23-2013 03:14 PM - edited 10-23-2013 03:30 PM
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.
10-23-2013 03:18 PM
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
10-23-2013 03:26 PM
@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)
10-23-2013 03:38 PM
Altenbach,
That solved my issue. Thanks a ton. Saved me a lot of time.
Marshman