# Want to save table data into pdf file in vision

**URL:** <https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [November 1, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934 "2022-11-01T16:11:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 1, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/1 "2022-11-01T16:11:58Z")

</div>

Hi Team,

I want to save table data in pdf file format in Ignition vision.  
Is it possible to do this?  
any idea?

Thanks

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 1, 2022, 4:38pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/2 "2022-11-01T16:38:27Z")

</div>

Probably need to use the report module.  
Create a report that has the proper parameters to mimic your table, and then using an event then call it via `https://docs.inductiveautomation.com/display/DOC81/system.report.executeReport` and then do something with it.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 1, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/3 "2022-11-01T16:45:59Z")

</div>

Thanks for your reply, but How we can pass table to Report module?  
Because I am getting this table data by using many filters and left joins and inner joins, very big, nested query.  
It is difficult to use same query in report, It is having some filter selection on screen and according to that it is showing final data.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 1, 2022, 5:07pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/4 "2022-11-01T17:07:28Z")

</div>

Convert it to a named query and that same query can be used in both instances.

Then when you call the report pass the parameters

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 1, 2022, 5:09pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/5 "2022-11-01T17:09:34Z")

</div>

Can we pass parameters to reports dynamically, means through scripting?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 1, 2022, 5:12pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/6 "2022-11-01T17:12:35Z")

</div>

Yes. Check that link I posted.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 1, 2022, 5:13pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/7 "2022-11-01T17:13:08Z")

</div>

okay, Thank you so much, will try with named query.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 2:04pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/8 "2022-11-02T14:04:07Z")

</div>

Hi,  
In this " `system.report.executeReport(path` `=` `"My Path"` `, project` `=` `"MyProject"` `, parameters` `=` `overrides, fileType` `=` `"pdf"` `)`"

for this Path parameterwhich name we need to pass, name of report or report viewer window?  
it is giving error report not exist, If I am giving viewer's name.  
In both cases not working.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 2:05pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/9 "2022-11-02T14:05:50Z")

</div>

> [@Anita.Shinde](#):
>
> it is giving error report not exist, If I am giving viewer's name

Yes path is the direct path to the report. You can get it by right clicking on the report and selecting copy path.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 2:08pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/10 "2022-11-02T14:08:43Z")

</div>

No need of report viewer?  
I tried by giving direct report path its not giving any error but nothing happened.  
Where it will get store or how it will get display?

this is sample code on event, Is anything wrong with this?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/13c132cf3e53b5a99235ebaaa8810098740fd808.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 2, 2022, 2:16pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/11 "2022-11-02T14:16:50Z")

</div>

It returns the bytes of the PDF (or other type). You can then write those to a local file or load into a PDF viewer. It doesn't send the result anywhere else. You need to assign that function's value to a variable.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/12 "2022-11-02T14:17:26Z")

</div>

The function system.report.executeReport will returns a `List[Byte] of the output.` as per the manual.

So you will need to couple that with the appropriate [system.file.saveFile - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.file.saveFile) and [system.file.writeFile - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.file.writeFile) functions to save that generated PDF to a location of the users choosing.

Alternatively you could use the [system.report.executeAndDistribute - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.report.executeAndDistribute) function to save it to a specific location on the _Gateway_ rather than the local client.

Something like this:

```auto
fileName = system.file.saveFile('Table', 'pdf','PDF File')
if fileName is not None:
	theReport = system.report.executeReport(path='Test',project='IPC_GEL_SUPERVISOR',fileType='pdf')
	system.file.writeFile(fileName, theReport)

```

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 2:30pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/13 "2022-11-02T14:30:00Z")

</div>

Ok, By using this I can store this file to local drive but somehow it's not opening.  
getting below error,

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/3/3376d23aa326a176ab1f3344e757515767cae272.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 2:31pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/14 "2022-11-02T14:31:55Z")

</div>

Are there any errors in your client? Any errors in the gateway?  
Did a file actually get created with data? IE is the PDF side larger than 0kb?

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 2:33pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/15 "2022-11-02T14:33:28Z")

</div>

Its a 0kb file, no data.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 2:34pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/16 "2022-11-02T14:34:27Z")

</div>

OK then you probably aren't getting any data from your report.

Post your entire script but copy and paste it here and use the \</\> button to properly format it so we can see if there is an error in the script.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 4:01pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/17 "2022-11-02T16:01:04Z")

</div>

I dont have much scripting, for now I am just trying a sample report.  
I followed below steps,

1. created one named query with simple select statement and and used that in report.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec479b99493a49219592ee90ad3bb8d164771d02.png)

1. Here is I have dragged some columns from that datasource

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/3/036d15f9c94d749abba26cd7aeb3c9a4992105e2.png)

1. and at last on button click event I am executing this report(like you share above).  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/770c10d5363204e177b1d58db559cf615080a15f.png)

also in report preview i can see the data, then not sure why it is not showing data in local file.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 5:24pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/18 "2022-11-02T17:24:32Z")

</div>

Have you saved the project?  
Are you doing this with the designer or the client?  
Can you create a window that shows the report just to make sure that it works?

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 2, 2022, 5:35pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/19 "2022-11-02T17:35:13Z")

</div>

yes, project is saved properly.  
here is one window, I dragged one report viewer and given that report path.  
it is showing data.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/b/5b2da93585bb847d260c43d18b443a9c7e249c95.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [November 2, 2022, 5:37pm UTC](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934/20 "2022-11-02T17:37:04Z")

</div>

It's possible that it doesn't work in Trial mode??? I'm not 100% sure on that. You may want to get with support if someone else doesn't jump in here and give you a better answer.

[Next page](https://forum.inductiveautomation.com/t/want-to-save-table-data-into-pdf-file-in-vision/65934.md?page=2)
