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: 

Report Generation Toolkit - Continue existing table

Solved!
Go to solution

Previously I have used TXT files (CSV) for storing test data. Some of the tests run for 1000+ hours, and collect anywhere from a few thousand lines of data to over a hundred thousand lines of data. Using this approach, I have to write VBA macros to analyze and format this data, which is very time consuming. I am looking to try using the LabVIEW Report Generation Toolkit (RGT) to write directly to an Excel spreadsheet and do some of the steps on the fly that the VBA macro does, to help reduce processing time and manual labor on the data analysis.

 

However, my concern is that sometimes we have to stop testing part-way through a long test and then continue and append the data to the existing data. I do not see how to accomplish this using the RGT. I imagine you would have to locate the last data in the spreadsheet...using a TXT file, LabVIEW does this automatically. In Excel, I use VBA code like this:

 

RowMax = SheetRD.Cells(SheetRD.Rows.Count, "A").End(xlUp).row

 

Does the RGT have any features like this, or am I going to have to call a macro and then work with the returned RowMax value?

0 Kudos
Message 1 of 11
(3,656 Views)

Have you thought of doing this with a database? MS SQL express is free, and it has a lot of capabilities that can make your life much easier.

Glad to answer questions. Thanks for any KUDOS or marked solutions 😉
0 Kudos
Message 2 of 11
(3,648 Views)

I'm sure that is a good option...however, I know LabVIEW, Excel and VBA pretty well and don't really have the time or ambition to learn a new database environment...If I start bumping into major limitations in Excel I'll start looking into more robust database sollutions. The original question isn't a limitation of excel, but possibly a limitation of the RGT...

0 Kudos
Message 3 of 11
(3,643 Views)

If your pause/resume is all part of your program, you can take the "next cell (bottom left)" that RGT gives you after you write data and keep that in memory, that will tell you where you left off.

 

Otherwise, you can open a report with your spreadsheet at the template, and read off the data looking for the first empty row.

0 Kudos
Message 4 of 11
(3,635 Views)
Solution
Accepted by topic author Ryan_G_EE

You can use Excel Get Last Row.vi from the Report Generation -> Excel Specific -> Excel General palette. Add 1 to get the next empty row.

 

Ben64

Message 5 of 11
(3,627 Views)

Ahh yes, there it is. I just didn't dig deep enough into the General list. Thank you!

0 Kudos
Message 6 of 11
(3,560 Views)

How would I go about it if I wanted to insert data at a specific cell in the excel doc?

 

  • My project requires an initial test and a final test for which one report is generated.
  • Initial test and final test will be done in two separate runs
  • For the initial test, I am sending the data to an excel document as a table with the MS Office Report Express vi
  • For the final test, please see attached image. I believe this could be the solution although I keep getting error 7. The path I have created is the path to the initial test report which I want to append.
0 Kudos
Message 7 of 11
(2,863 Views)

Hi Sabrina,

 

Since you are receiving Error 7, I suspect the problem lies within how you are building your path and LabVIEW can't find the file. Would you be able to put a probe on the wire going into New Report subVI or wire an indicator that will show the file path you are calling and if it matches the file you want to append to?

 

Cici Z.

Applications Engineer

National Instruments

0 Kudos
Message 8 of 11
(2,839 Views)

@cici_p wrote:

Hi Sabrina,

 

Since you are receiving Error 7, I suspect the problem lies within how you are building your path and LabVIEW can't find the file. Would you be able to put a probe on the wire going into New Report subVI or wire an indicator that will show the file path you are calling and if it matches the file you want to append to?

 

Cici Z.

Applications Engineer

National Instruments

I've attached the screenshot with the probe and the path is directed to the exact place I want. What I think could be the problem is that "PTS Report" (at the end) is the name of the file, not a folder. This document I am trying to edit, which is the outcome of the MS Office Report vi, is no longer a template (now .xls). Could the error also be caused by the input for New Report being template rather than path?

0 Kudos
Message 9 of 11
(2,831 Views)

Hi Sabrina,

 

If "PTS Report" is the excel file, try to add the .xlsx extension to the file path that you are referring to.

 

In terms of path vs template, I'm not certain I understand. The reference passed to New Report is still a path not a template.

 

Cici Z.

Applications Engineer

National Instruments

0 Kudos
Message 10 of 11
(2,813 Views)