Execute the same report x times and perspective download as multiple pages in a single file

Is this possible?
Before I start digging in…

I am making wip tags through reporting. We usually print four at a time. One by one.

I can’t seem to find anything on running a report multiple times on a script and adding the returned arrays together into a single file or array. Is this possible? Are reports iterable?

In this case, it would be for system.perspective.download.

Or execute and distribute to the gateway to a known path and perspective. download there…
I was experimenting a little bit and crashed my production gateway trying to figure it out… lol


INFO   | jvm 1    | 2019/10/25 01:43:58 | <string>:12: RuntimeWarning: PyTableCode.call caught a Throwable that is not an Exception:
INFO   | jvm 1    | 2019/10/25 01:43:58 | java.lang.OutOfMemoryError: Java heap space
INFO   | jvm 1    | 2019/10/25 01:43:58 | Jython internals might be in a bad state now that can cause deadlocks later on.
INFO   | jvm 1    | 2019/10/25 01:43:58 | See http://bugs.jython.org/issue2536 for details.
INFO   | jvm 1    | 2019/10/25 01:43:58 | W [p.a.script                    ] [06:43:58]: Error running function "runAction(self, event)". view=Pages/Charts@D, project-name=SCADA, component=root/Container/CoordinateContainer_0/Button
INFO   | jvm 1    | 2019/10/25 01:43:58 | com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last):
INFO   | jvm 1    | 2019/10/25 01:43:58 |   File "<function:runAction>", line 12, in runAction
INFO   | jvm 1    | 2019/10/25 01:43:58 | java.lang.OutOfMemoryError: Java heap space
INFO   | jvm 1    | 2019/10/25 01:43:58 | 	at java.base/java.util.Arrays.copyOf(Unknown Source)
INFO   | jvm 1    | 2019/10/25 01:43:58 | 	at java.base/java.util.ArrayList.grow(Unknown Source)
INFO   | jvm 1    | 2019/10/25 01:43:58 | 	at java.base/java.util.ArrayList.grow(Unknown Source)
INFO   | jvm 1    | 2019/10/25 01:43:58 |  

Combining PDFs is not as simple as just appending the byte arrays to each other - in fact, it’s decidedly non-trivial. Looks like there are some command line tools you could use: https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf - you’d have to execute the reports and save them somewhere on the gateway, then run an external command, then load those bytes into system.perspective.download.

Figures…

So i guess it’d be easier to make three more “reports” or one report with 4 pages and a bunch of params to suit. Can you suppress the number of pages any way?

or maybe they just keep printing them one by one and I fry bigger fish…

If you’re able to do it with nested queries (or even making a nested datasource through scripting) could you then have each individal item that needs to be printed out inside one unstructured details row? Then you don’t need to worry about empty pages - the table will paginate and populate itself with whatever you need.

The terminology around this stuff is pretty confusing, so let me know if that doesn’t make any sense - but as described, I think you can probably get away with one report and a nested query setup.

1 Like

I suppose. I get the idea.

I am passing params from the table selection properties. I wanted to be able to run through them

.props.selection.data[0].lot
…props.selection.data[0].count
…props.selection.data[1].lot

so I would have to build from that data…

Thanks for the help man!