Example Code

Automating Report Generation with LabVIEW and DIAdem

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW Report Generation Toolkit
  • LabVIEW
  • Other

Code and Documents

Attachment

Overview

The delivery of a report often culminates the completion of a milestone or project, meaning the job is not finished until a report is completed and hand off occurs. Engineers have been successfully automating tests and processes with NI LabVIEW software for multiple decades, but few automate the reporting task. This example shows how to combine LabVIEW and DIAdem to automate the process of generating reports.

 

 

Description

This example is in response to the article "Three Steps to Save Three Weeks with LabVIEW - Automating Report Generation", first published in the Q1 2010 Edition of the Instrumentation Newsletter. 

This Example will create two identical .htm reports after it runs. The two reports are created using two different methods that you could use to automate report generation.

The Script generated report will be found inside the HTML Script Folder and the Command generated report will be found in the same location of the project.

Here's a list of the example files included in this entry, along with the purpose of each. These three files must be saved in the same directory for the example to work.

  • LV DIAdem Report Gen Example.vi
    • This is the LabVIEW example code. There are two sections to the code. The first section generates four waveforms and writes them to a single TDMS file. The second section uses the LabVIEW DIAdem Connectivity VIs to programmatically use DIAdem to automate the report generation. For this example to execute, the VI must be saved in the same directory as the DIAdem Report template (Report Template.tdr) and the DIAdem script (HTML Export Script.vbs). It will create two identical .htm reports after it runs. The two reports are created using two different methods that you could use to automate report generation.
  • Report Template.TDR
    • This is the DIAdem Report Template. It must be saved in the same directory as the LabVIEW Example to have the example work. If you want to see what the template looks like, follow these steps:
      1. Open DIAdem
      2. While in the NAVIGATOR view, click on "Delete Internal Data"
      3. Switch to the REPORT view by clicking on REPORT in the left pane
      4. Select File >> Open... and select Report Template.TDR
    • Because the report template already has data references linked to the objects in the report, you will receive a generic message that errors have occurred. This is expected since the corresponding data file is not currently loaded into the DIAdem Data Portal.
  • HTML Export Script.VBS
    • This is the DIAdem SCRIPT code. It contains a single line of code which calls the function to export a HTML report (PicHTMLExport). If you want to see the code in DIAdem, follow the procedure above, but select File >> Open when in the DIAdem SCRIPT view.

 

 

Requirements

Install the software in the following order:

  1. LabVIEW 2012 (or compatible)
  2. Diadem 2012 (or compatible)
  3. LabVIEW DIAdem Connectivity VIs 3.0.1 (or compatible)

 

 

Steps to Implement or Execute Code

1. Download and open the project "Automated DIAdem Report Generation_LV2012_NI Verified"

2. Open the VI "LabVIEW DIAdem Report Generation(Main)"

3. Enter the report author name
4. Run the VI
5. Check the directory where the project is saved to view the report

 

 

Additional Information or References

What are LabVIEW and DIAdem? If you're unfamiliar with either of these software environments, have a look at the following resources:

  

LabVIEW example front panel.

FP.PNG

 

LabVIEW example block diagram (Data Generation)

 Generate DataFile.PNG

LabVIEW example block diagram (Report Generation)

Report generation VI BDBD.PNG

 

Diadem Report Example

sawtooth wave.PNG

 

 

The DIAdem environment, highlighting the icon to click on to Delete Internal Data loaded in the Data Portal.

DIAdem Clear Data.png

 

Report Template.TDR loaded into DIAdem. The tabs at the bottom of the screen indicate that this is a multi-page report.

DIAdem Report Template.png

 

HTML report created at the conclusion of the LabVIEW example execution.

HTML Report.png

 

 

 

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

Great stuff, thanks for all the detail!

Todd S.
LabVIEW Community Manager
National Instruments
Richie20
NI Employee (retired)
on

this is one of my favorite things to do. Very powerful for users who want to automate reporting.

gstathatos
Member
Member
on

Hello,

I have download your example and follow your instuctions how to run this example and it appears that LV creates the HTML report through DIADEM but there aren't any data on it.

I also found this https://forums.ni.com/t5/DIAdem/Exporting-LabVIEW-data-to-DIAdem-PDF-Report/td-p/818647 where there is a similar issue with pdf report through DIADEM but this also has to do with the exe.

Any ideas what this is happening?

image.png

nshl
Member
Member
on

Hi

The VI : diadem load data.vi is missing in the folder. The VI can't be tested.

Could you please add this item? I already check and I have the toolkit.

Thank you!

nshl
Member
Member
on

nshl_0-1679566199429.pngnshl_1-1679566218921.pngnshl_2-1679566232866.png