# System.Report.executeandDistribute()

**URL:** <https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107>\
**Category:** Ignition\
**Created:** [April 21, 2017, 2:25pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107 "2017-04-21T14:25:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingnoboru](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kingnoboru](https://forum.inductiveautomation.com/u/kingnoboru)\
**Post date:** [April 21, 2017, 2:25pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/1 "2017-04-21T14:25:51Z")

</div>

Hi to all,  
I’m trying to print a report using script, here the code:

```auto
if system.tag.read("PLC_MetalCan/PalletPresente").value == 1:
    system.report.executeAndDistribute(path = 'EtichettaPallet' , 
    project = 'PLC_MetalCan' ,
    action = 'print' , 
    actionSettings = {"primaryPrinterName":"Markem-Imaje 2630 (300 dpi)","copies":1 })

```

All seems fine but the page printed is all White.  
do you know where’s the mistake?

thank’s in advance for all the replies.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [April 21, 2017, 8:53pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/2 "2017-04-21T20:53:52Z")

</div>

Printing issues are often a bit challenging to troubleshoot. I don’t see anything obviously wrong with your setup, but I almost never print reports. 🙂

Does your report print okay when you test it in the Schedule panel in the reporting workspace? Does it save okay if you change the distribute action to ‘save’ and give it a path/filename relative to the gateway?

Is there anything in the gateway logs? Try turning the reporting.Data log to debug to get the most info.

---

<div class="post-metadata">

**Author:** ![m.castagnetti](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@m.castagnetti](https://forum.inductiveautomation.com/u/m.castagnetti)\
**Post date:** [April 22, 2017, 8:07am UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/3 "2017-04-22T08:07:01Z")

</div>

Hi,  
we create a label with the report.  
If i create PDF with this script :

```auto
settings = {"path":"C:\\", "fileName":"Report.pdf", "format":"pdf"}
system.report.executeAndDistribute(path="EtichettaPallet", project="PLC_MetalCan", action="save", actionSettings=settings)

```

and it’s perfect.

If i use this script and send directly to the printer :

```auto
system.report.executeAndDistribute(path = 'EtichettaPallet' , 
    project = 'PLC_MetalCan' ,
    action = 'print' , 
    actionSettings = {"primaryPrinterName":"Markem-Imaje 2630 (300 dpi)","copies":1 })

```

i see a job in the queue but print a white label?  
Is the problem that is not processed from the printer driver ? There’s another system for print directly ?

BR

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [April 24, 2017, 2:19pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/4 "2017-04-24T14:19:03Z")

</div>

Without turning your logs to trace, it’s going to be hard for you to debug further. Your best bet is to contact support and have them help you with this.

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 16, 2019, 3:39pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/5 "2019-12-16T15:39:31Z")

</div>

@KathyApplebaum I’m trying to troubleshoot a System.Report.executeandDistribute() issues. Where can I find the logs you’re talking about?

Thanks,  
MMurphy

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [December 16, 2019, 4:30pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/6 "2019-12-16T16:30:26Z")

</div>

It’s going to depend on where you think the problem might be, but I’d start with `reporting.Scripting`. If that doesn’t do it, try turning all of `reporting` to trace and use the [MDC keys](https://docs.inductiveautomation.com/display/DOC80/Troubleshooting+Guides) for your report name and your project name to find the log statements for that report.

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 16, 2019, 4:37pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/7 "2019-12-16T16:37:15Z")

</div>

I was able to find the logs. My issue was caused by Ignition changing the string I was using for the path to where I wanted the report saved.

I was running something like the script below.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/9a695d24c3aa1aa6b38d302bf0bee2e83b918b13.png)

The leading backwards slash was being dropped by Ignition. Log screenshot below.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/189f95f5c46fefa7684e51d86174b2fe438f0d7f.png)

Is this expected behavior? I tried making a string tag of " \ " within the script and it didn’t like that either.

M Murphy

EDIT: To be clear, my path had two slashes in the script but by the time it hit the log it only had one.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 16, 2019, 4:50pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/8 "2019-12-16T16:50:55Z")

</div>

That’s a Python (and many other languages) thing, to clarify, not an Ignition thing - backslashes are a common ‘escape’ character, so if you need to represent a literal newline, say, in a string, you use `"\n"`, since there’s no “character” that can represent a newline. The escape character _for_ the backslash itself is…two back slashes - so `"\\"` is _actually_ defining a single character `\` in the output. You can prefix the Python string literal with `r` to make it “raw”, meaning it won’t process escape characters:  
`sPath = r"\\vmware-host\Shared Folders\etc"`  
Or, you can “double” the escape characters to make the same output string:  
`sPath = "\\\\vmware-host\\Shared Folders\\etc"`

---

<div class="post-metadata">

**Author:** ![mmurphy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmurphy/32/11430_2.png) [@mmurphy](https://forum.inductiveautomation.com/u/mmurphy)\
**Post date:** [December 16, 2019, 6:35pm UTC](https://forum.inductiveautomation.com/t/system-report-executeanddistribute/14107/9 "2019-12-16T18:35:41Z")

</div>

Awesome. Thanks @paul-griffith!
