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: 

Best method to convert this old print.vi to excel

Solved!
Go to solution

Hello once again all of you brillant LabVIEW maestros. Once again, on this project I've inherited...I'm looking for recommendations. I'm trying to figure out the best way to get rid of the old printing .vi and output a .csv or .xls file. I think I could take all of the information and strategically build and array and just go that route. Either to output a .csv file or use the report and generation toolkit for excel. But all of you guys know better than I and I'm trying to do this right. Thank you. 

Download All
0 Kudos
Message 1 of 8
(2,033 Views)

Hello everyone. I'm looking to replace this old printing VI. The output does not need to look as fancy as the old printed version...rows and columns with headers will do. I'm pretty sure I can figure out how to build an array to output a simple .csv file or use the report generation toolkit, but I always get great ideas from you guys so here I am again. 

Download All
0 Kudos
Message 2 of 8
(2,066 Views)

My apologies, I posted this question earlier but it wasn't showing up in my feed so I thought it did not go through, so I posted it again and I see no option to delete this one. 

0 Kudos
Message 3 of 8
(2,060 Views)

It is really hard to tell much about LabVIEW code by seeing a picture of part of the Block Diagram.  Suppose I had a 15 page listing of a C++ program and showed you two pages and asked for help -- I can hear you laughing.

 

Please attach the VI (or VIs) involved.  Are you interested in writing a .csv file (which is just an ordinary text file, but one that uses commas or <tab>s (or some other character you decide upon) to separate columns, and NewLines to separate "rows" (a Row is a "row" of text, what we often call a "line of text").  If you have the Report Generation Toolkit, you can also write an actual .xlsx file (well, actually you need to have Excel installed, as the LabVIEW functions call on Excel to do the Hard Work).  There are number of examples, some that ship with LabVIEW, some that can be found in this Forum and on the Web, that show you how to do this ...

 

Bob Schor

Message 4 of 8
(2,018 Views)

Yes yes I know you guys hate those png's and jpg's us newbies post.  🙂

Attached is the sequence that has the cute little print SubVI. I cannot post the entire VI, but that will show what is connected. Other than all of the local variables, that is. But I've also posted the SubVI itself. Enjoy.

 

Boss man just wants the info in a plain jane spreadsheet. He doesn't care if it's pretty. He's fine with outputting into a .csv file and then getting the error before opening in excel. Or I can use the report and generation toolkit. I just like to ask you guys first because you always have something enlightening to say. 

Download All
0 Kudos
Message 5 of 8
(2,015 Views)

@Kastun27 wrote:

Yes yes I know you guys hate those png's and jpg's us newbies post.  🙂

Attached is the sequence that has the cute little print SubVI. I cannot post the entire VI, but that will show what is connected. Other than all of the local variables, that is. But I've also posted the SubVI itself. Enjoy.

I assume by "the cute little print SubVI" you mean the smaller "print.vi" file.  This is not a usable LabVIEW VI -- it appears to be a VI with no Front Panel and a Block Diagram consisting of a static image.  For example, trying to see the other Frames of the Stacked Frame Sequence shows that I'm clicking on a non-responsive Image.  This completely wastes my time.  I will make one more comment below, then will stop "inconveniencing" you.

 

Boss man just wants the info in a plain jane spreadsheet. He doesn't care if it's pretty. He's fine with outputting into a .csv file and then getting the error before opening in excel. Or I can use the report and generation toolkit. I just like to ask you guys first because you always have something enlightening to say. 

My advice to "Boss man" is to hire a competent LabVIEW Developer, tell her (or him) what he wants to accomplish, the inputs and outputs, and don't provide the existing code which is such a mess (with weirdly-designed controls that disguise their true nature, use of Stacked Sequences instead of single-purpose sub-VIs with custom icons, connected via the Error In and Error Out lines in the lower corners, etc.).  Ask to see an example of their code, and if it fits on a laptop (or modest-sized monitor) screen and can be explained in 5-10 minutes, with mostly-horizontal parallel wires and at least a few (and even as many as two dozen) 32x32 sub-VIs visible in the central While Loop, that's Extra Credit.  Ask to see the inside of one of those sub-VIs, as well -- it should have 2-4 Inputs on the front Panel (one being Error In), 2-4 Outputs (one being Error Out), and the Block Diagram should definitely fit on a screen and have a "single purpose" (though it can, and in many cases should, have its own set of sub-VIs).


Good luck.  Try not to antagonize too many people willing to help you.

Bob Schor

Message 6 of 8
(1,979 Views)
Solution
Accepted by topic author Kastun27

Your print VI is just a graphic representation of all your individual pieces of data and arrays.  Somebody determined how they wanted it to look.

 

You need to create a new subVI, Perhaps one that is pin for pin identical as that Print.VI, but one that takes all of those individual pieces of data and builds it into a 2-D string array.  Then you take that 2-D string array and send it to a Save to Spreadsheet File.

 

What you need to do first is design in Excel a template as to where all the random individual pieces go and where all the array data goes.  (Do the arrays ever change in length?)  Basically how does "boss man" want the spreadsheet laid out?

 

Once you have that in Excel, use that as a model so you can use the appropriate build array functions, and possible some other array functions like Replace Array subset that grabs all that piecemeal data you've sent into the VI to the 2-D string array that you'll save to the .CSV file as the final step.

Message 7 of 8
(1,978 Views)

Thank you. 

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