From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Call and Save Reports/Export to PDF using Dataplugin?

Solved!
Go to solution

Hello,

My dataplugin is for various '.csv' files, and works perfectly when reading and loading the files. But, what would really be nice is if I could then somehow bring the data in those files into their appropriate report templates and then export that report as a '.pdf'.

So, I tried adding:

      Call DataFileLoad([Filepath],[Script]
      Call DataFileSave([Filepath], ".TDM","TDM")
      Call Report.LoadLayout([Report Path])
      Call Report.Sheets.ExportToPDF([Path to save .pdf] ,False)
      Call Report.Refresh
      Call Data.Root.Clear()

 

When I test the dataplugin by manually indexing a file, I receive the error: Variable is undefined: 'DataFileLoad'"

So, if it is reading it as a variable does that suggest that it does not recognize functions unless they are stated in the sub?

Is it possible to do what I would like it to do?

 

Thanks.

0 Kudos
Message 1 of 6
(6,818 Views)
Solution
Accepted by Kevin_McG

Hi Kevin,

 

Your VBScript DataPlugin can not call "red" DIAdem commands.  The VBScript host that the DataPlugin uses contains only the basic VBScript functions plus a few specific DataPlugin commands but none of the rest of the DIAdem commands.

 

You'll need to use a DIAdem VBScript to load the data file, load the layout, and save the PDF file.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 6
(6,766 Views)

Do you know of any way to automate the calculations and reports? I have the script written, just need to make it so that no operator is required to just hit a button to make it run.

 

I have searched the forums and I only see reference to running a script on startup, which doesn't help.

 

Thank you for your help.

 

 

0 Kudos
Message 3 of 6
(6,748 Views)
Solution
Accepted by Kevin_McG

Hi Kevin,

 

DIAdem does not provide scheduling services, so some entity needs to tell DIAdem to start.  You can either manually set up a DIAdem to poll for files to pricess in an endless loop, or you can use the Windows Task Scheduler to launch a DIAdem instance periodically that automatically looks for files to process for a certain duration (after which it shuts itself down to avoid any potential long term memory leaks).

 

R&D is interested in improving our offering for this use case, but as of DIAdem 2014 we do not have anything new available.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 6
(6,726 Views)

Hi Brad,

 

could you please provide an example how to save the data if 

Call DataFileSave([Filepath], ".CSV","CSV")

doesn't work?

 

Thank you very much!

0 Kudos
Message 5 of 6
(3,401 Views)

Hi Dsfgg,


You're going to have a lot more success getting responses by creating a new forum post, since this forum closed in 2014.

Whenever you do make a forum post, can you clarify what you mean by "doesn't work"? Are you seeing an error when running this code?

0 Kudos
Message 6 of 6
(3,379 Views)