Hi Team,
I want to save table data in pdf file format in Ignition vision.
Is it possible to do this?
any idea?
Thanks
Hi Team,
I want to save table data in pdf file format in Ignition vision.
Is it possible to do this?
any idea?
Thanks
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.
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.
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
Can we pass parameters to reports dynamically, means through scripting?
Yes. Check that link I posted.
okay, Thank you so much, will try with named query.
Thanks.
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.
Yes path is the direct path to the report. You can get it by right clicking on the report and selecting copy path.
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?
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.
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 and system.file.writeFile - Ignition User Manual 8.1 - Ignition Documentation 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 function to save it to a specific location on the Gateway rather than the local client.
Something like this:
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)
Ok, By using this I can store this file to local drive but somehow it's not opening.
getting below error,
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?
Its a 0kb file, no data.
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.
I dont have much scripting, for now I am just trying a sample report.
I followed below steps,
also in report preview i can see the data, then not sure why it is not showing data in local file.
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?
yes, project is saved properly.
here is one window, I dragged one report viewer and given that report path.
it is showing data.
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.