LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate new excel report after some time using report generation tool kit.

HELLO..

i am trying to genertae report in excel format , i am getting the report properly. Now i want to generate reprot in new excel after some time, if i run the VI the report is updating in previous excel sheet only. i want to generate new report in new excel sheet.

i want to make a new report in new excel sheet after 24 HRS ,it should generate automatically for every 24 hrs.

could you suggest me a code plz.....

0 Kudos
Message 1 of 15
(4,771 Views)

I'm reasonably sure (meaning "I think it's so, but don't quote me") that with LabVIEW's Report Generation Toolkit, you can have only one Excel Workbook open at a time.  Furthermore, I know (from having done it) that "LabVIEW is faster than Excel", meaning if you do a Dispose Report to close Excel and then immediately do a New Report to re-open it, you will get an error.

 

The following process works for me (tested with RGT from LabVIEW 2012 and 2014):

  • Generate an Excel Report
    • If you are working with an existing report (reading or modifying), specify it as a Template with New Report
    • Use RGT function to read or write cells as needed
    • To save changes, use Save Report
    • When finished, close Excel with Dispose Report
  • Delay for a brief while.  I think I usually use 100 msec.  This lets Excel close properly.
  • Repeat these steps as needed for subsequent reports.

If your goal is to generate reports continually, with a new report being generated every 24 hours, the brief "gap" shouldn't be much of an issue if you are using LabVIEW, as you can use a Producer/Consumer Design Pattern to allow the (Excel) Consumer to briefly pause the requisite amount of time to handle the switch-over.

 

Bob Schor

0 Kudos
Message 2 of 15
(4,753 Views)

Hi,

Thanks for your reply,

I am not working on existing excel report, my intension is pretty clear that , to generate new excel report when ever i want (depends upon condition ).

It means if the condition is true then it should generate new excel report.

 

0 Kudos
Message 3 of 15
(4,738 Views)

My instructions are the same whether reading or writing.  The important point is you must end the "old" report with the sequence "Save Report", "Dispose Report", "Wait (ms)" (for some time, I suggest 100 msec).  To generate the next report, you then begin again with "New Report".

 

Note that it is possible that you'll still get an error when opening the next New Report.  If this happens, try increasing the time delay to give Excel more time to close and re-open.  This may well depend on the speed of your machine, what version of Office, etc.

 

Bob Schor

0 Kudos
Message 4 of 15
(4,728 Views)

@sridhar..reddy wrote:

HELLO..

i am trying to genertae report in excel format , i am getting the report properly. Now i want to generate reprot in new excel after some time, if i run the VI the report is updating in previous excel sheet only. i want to generate new report in new excel sheet.

i want to make a new report in new excel sheet after 24 HRS ,it should generate automatically for every 24 hrs.

could you suggest me a code plz.....


There is a bit of confusion here. You're talking about generating report in new Excel after some time. What do you mean by new Excel? New worksheet? New workbook?

Later you are talking about new report in new Excel sheet.

 

If you just want to add data to a new worksheet (of a single workbook) every 24hrs then you can do it using the Excel Get Worksheet.vi, Excel Add Worksheet.vi and Excel Rename Worksheet.vi (I would use this one to rename the worksheet to the date of the data capture). By default a workbook is created with 3 worksheets, you can use Excel Get Worksheet.vi to select them. If your test run for more than 3 days then use Excel Add Worksheet.vi to add a new worksheet every additional day. These vi are located in the Excel General and Excel Advanced palettes of the Report Generation Toolkit.

 

If you want to create a new workbook every 24 hrs, then follow Bob's instructions.

 

Ben64

0 Kudos
Message 5 of 15
(4,715 Views)

I understood now .. Thankyou so much.

if you dont mind can you attach the sample code what you said about.

i want to know the code for adding a new work sheet after every 24 hrs .

 

 

0 Kudos
Message 6 of 15
(4,706 Views)

sridhar..reddy wrote:

I understood now .. Thankyou so much.

if you dont mind can you attach the sample code what you said about.

i want to know the code for adding a new work sheet after every 24 hrs . 


 

 

No, but if you make and post a test VI that you think does what I clearly explained, I'll be happy to make comments on your code.  But be sure to post code, that is, attach a VI or embed a Snippet (and if you don't know about Snippets, just attach the VI).  This way, if I want to indicate a change, I can change your code and re-post it.

 

Bob Schor

0 Kudos
Message 7 of 15
(4,695 Views)

hi, 

i am a new user for LabVIEW. I use LabVIEW 2012. I my company we manufacture the motor. my work is test the motor with reference of barcode and calculate power,power factor,RPM. The reading are i get it. But i don't know how to generate customized report. i have report generation toolkit for microsoft. please any one give example.

0 Kudos
Message 8 of 15
(3,983 Views)

Hello ponkumar,

 

Go to example finder (Help > Find examples). In the Section Toolkits and Modules , You will find some report generation examples.

check this link Creating a Report in Microsoft Excel Using the LabVIEW Report Generation Toolkit

 

0 Kudos
Message 9 of 15
(3,974 Views)

You can also find (what I think is an excellent) example by searching on this Forum for "Revised " (type the word Revised, a space, let the search find some things, then choose the one that "looks right" ...).  Take a look, run the code and see what it does, make some changes to "play" with it, then try incorporating its ideas into your own code.

 

Note that this is for making "Excel" Reports, i.e. creating Excel Workbooks.  You can also create HTML Reports (using slightly different Functions, of course) and Word Documents with the Report Generation Toolkit.

 

Bob Schor

0 Kudos
Message 10 of 15
(3,962 Views)