# Report initial load reportLoading finished but report blank

**URL:** <https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084>\
**Category:** Ignition\
**Created:** [August 31, 2012, 12:07pm UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084 "2012-08-31T12:07:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DomArmstrong](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DomArmstrong](https://forum.inductiveautomation.com/u/DomArmstrong)\
**Post date:** [August 31, 2012, 12:07pm UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/1 "2012-08-31T12:07:30Z")

</div>

Having an issue where I am printing multiple reports at a time.  
I’m using the reportLoading flag to check whether the report is ready to print:

[code]if event.propertyName == “reportLoading”:  
reportLoading = event.source.reportLoading

```
window = event.source.parent.parent

if reportLoading == True:
	window.reportNotReady = True

if window.reportNotReady == True and reportLoading == False:
	window.reportReady = True[/code]

```

This is working fine generally, except for the very first load from a new client or after updating the client.  
I am getting the flag reportReady as True but the report is printing blank (the report is formed fine with the defaults but the variable sections are blank)

The following reports print fine and the flag works as expected.

I have a work around which is to open and close the first report before trying to print it but its a little bit horrible.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![Michael.Stofan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.stofan/32/3342_2.png) [@Michael.Stofan](https://forum.inductiveautomation.com/u/Michael.Stofan)\
**Post date:** [September 1, 2012, 12:00am UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/2 "2012-09-01T00:00:21Z")

</div>

Any chance you can post the window so we can take a look?

---

<div class="post-metadata">

**Author:** ![DomArmstrong](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DomArmstrong](https://forum.inductiveautomation.com/u/DomArmstrong)\
**Post date:** [September 4, 2012, 7:45am UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/3 "2012-09-04T07:45:28Z")

</div>

I can’t send the actual screen over unfortunately, I will have a look at putting together a mock up when I have a chance.

---

<div class="post-metadata">

**Author:** ![DomArmstrong](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DomArmstrong](https://forum.inductiveautomation.com/u/DomArmstrong)\
**Post date:** [September 6, 2012, 9:38am UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/4 "2012-09-06T09:38:20Z")

</div>

Hi,

I’ve put together a lash up of what’s happening, it’s not actually how we are doing it as we are simply passing an id to the report and loading data from a database, also the report if more complex.

In fact I am getting the opposite affect now… The very first time the script is run either after a project update or a new client is opened the reportReady fires incorrectly. Every time after it will fire fine.

Dom  
[report printing test.proj](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/37e73f90dd77350c7960b9ce46e6334808532fc9.proj) (24 KB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 6, 2012, 11:17pm UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/5 "2012-09-06T23:17:27Z")

</div>

![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:") Where does the report actually get printed?

---

<div class="post-metadata">

**Author:** ![ISDProj](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@ISDProj](https://forum.inductiveautomation.com/u/ISDProj)\
**Post date:** [September 6, 2012, 11:51pm UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/6 "2012-09-06T23:51:56Z")

</div>

Dom,  
Without looking at your “lash up” project, shouldn’t you be looking at the “event.newValue” rather than “event.source.reportLoading”?

Just my two-bob’s worth (…for what it’s worth) 😃

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 7, 2012, 12:01am UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/7 "2012-09-07T00:01:26Z")

</div>

Those two value should be equivalent. I think he just needs an invokeLater, maybe with a little bit of “fudge time” in there on his call to print. But I couldn’t find the call to print…

---

<div class="post-metadata">

**Author:** ![DomArmstrong](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@DomArmstrong](https://forum.inductiveautomation.com/u/DomArmstrong)\
**Post date:** [September 7, 2012, 9:08am UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/8 "2012-09-07T09:08:29Z")

</div>

The printing all happens in the ‘action performed’ of the print button. The call to print is `report.print(None, 0)`.

I am using invokeLater, we are worried about slow machines or connections. I am currently using some loops with delays say 200ms to check the window has been found and then the reportLoading has finished.

We are trying to make this more robust by using the `event.source.reportLoading` property to check that the report has in fact finished loading and not guessing.

The problem seems to be that the event fires inconsistently. In our initial tests of the property it seemed to always fire:  
False, (report not loading?)  
True, (report is loading?)  
False (report finished loading?)

Apart from the first time the report has loaded it seems to only fire False. Maybe somehow I am missing the other event fires? Or thinking about this wrong?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 7, 2012, 10:58pm UTC](https://forum.inductiveautomation.com/t/report-initial-load-reportloading-finished-but-report-blank/5084/9 "2012-09-07T22:58:54Z")

</div>

Ok, I looked into this, and here’s what’s going on. You’re essentially just missing the first reportLoading=true that you’d expect, because it happens before your property change listener script is installed.

There are various steps to opening a window, and before the script event listeners are registered, the components get deserialized which is what causes the first reportLoading=true to happen (that you’re missing). Because report loading is asynchronous, you’re catching the reportLoading=false caused by that first event. Then a binding comes back with a value, which causes the second pair of reportLoading=true, reportLoading=false.

I’ve made some changes as of 7.5.3 that make the events appear as you expected them, but you’ll still get (at least!) two pairs of loading true-\>false. Because of this, I’d do something like the following:

Each time the reportLoading=false happens, record the timestamp (via java.lang.System.currentTimeMillis(), perhaps). Maybe put this number on a property on the root container or something. Only print when reportLoading=false AND the timestamp is at least 1000millis old (or something).
