# Report viewer refresh

**URL:** <https://forum.inductiveautomation.com/t/report-viewer-refresh/113194>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [January 10, 2026, 10:39am UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194 "2026-01-10T10:39:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dominic.iannozzi](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dominic.iannozzi](https://forum.inductiveautomation.com/u/dominic.iannozzi)\
**Post date:** [January 10, 2026, 10:39am UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/1 "2026-01-10T10:39:51Z")

</div>

Hello erveryone,

I have a report with two custom properties.

The user selects one or more rows from a table and clicks a button to print the relative labels.

The problem is that a multiple selection does not update the report parameters and I basically get the same label printed n times.

I have debugged the code and I can see that in the for loop the data I expect is infact correct

I have tried to add an invokelater function to pause the code for the report to update but it’s not working.

What am I missing ??

Thanks in advance,

```python
t = event.source.parent.getComponent('Table')
t1 = t.getTable()

# righe selezionate
sr = t1.getSelectedRows()
# totale righe selezionate
src = t1.getSelectedRowCount()

def	refresh():
	if nome_stampante != '':
		reportViewer = event.source.parent.getComponent('Report Viewer')
		reportViewer.print(nome_stampante, False)

for x in sr:
	
	order_id = t1.getValueAt(x, 0)
	codice = t1.getValueAt(x, 2)		

	event.source.parent.getComponent('Report Viewer').CODICE = codice
	event.source.parent.getComponent('Report Viewer').ORDER_ID = order_id

	#system.gui.messageBox(str(codice) + ' ' + str(order_id),'')
	
	system.util.invokeLater(refresh,2000)		

	#exit()
	
		

```

---

<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:** [January 10, 2026, 3:35pm UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/2 "2026-01-10T15:35:44Z")

</div>

You can't do this will a simple loop in a script. `system.util.invokeLater()` **does not wait** in the caller--you get a bunch of `refresh()` calls piled up together in the event queue. **All** of your assignments to `codice` and `order_id` have executed before the first invoked `refresh()` runs.

What could work would be a single `invokeLater` to print the first label, and that refresh doing the next `invokeLater` for another label. You will need to learn to pass arguments to `refresh` via `partial()` or default args in order to track the place in the list.

---

<div class="post-metadata">

**Author:** ![Vi\_Quang](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vi_quang/32/82707_2.png) [@Vi\_Quang](https://forum.inductiveautomation.com/u/Vi_Quang)\
**Post date:** [January 12, 2026, 4:23pm UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/3 "2026-01-12T16:23:45Z")

</div>

Supplied code is for 8.3

When you set the parameters (CODICE, ORDER\_ID), the ReportViewer reloads the report with the new parameters applied. If the ReportViewer is already busy loading a report, it will queue the load request until the ReportViewer has completed reloading that report. After it completes loading, it will then load the most recent request in the queue.

Here’s a project to more easily understand the problem. It has a 5 second delay when loading the dataset. It will popup a Print window that you can hit cancel and dismiss or print. Note what you see in the ReportViewer, when the Print window pops up, is what will be printed.

[report\_print\_from\_table\_selection\_illustration\_of\_problem.zip](https://forum.inductiveautomation.com/uploads/short-url/rEFA0u6sHwAeWg56lDHdHKY13xj.zip) (12.7 KB)

In the above project, if you select all 3 items in the table what is loaded is not deterministic due to queuing. It might load the report for **order\_id** 1 and **order\_id** 3 but not **order\_id** 2.

When you call **`print()`**, this will print what’s currently displayed, or if the viewer is showing loading, what was last displayed. So in the above scenario, if **order\_id** 2 was never loaded, it can never be printed, or if the `print()` call is not called for the loaded **order\_id** that won’t be printed either.

One way to get this to work is to do the following:

1. Set the parameters (CODICE, ORDER\_ID) this will trigger a load of the report
2. Wait until the report finishes loading
3. Print the report
4. Go to the next selected item

For step 2 above, we use ReportViewer#onReportGenerated which is called after a report loads. Here’s a solution.  
[report\_print\_from\_table\_selection\_solution\_1.zip](https://forum.inductiveautomation.com/uploads/short-url/9IDLXrNoOwlITdQ242mJll4cVnh.zip) (13.2 KB)

Another possible route is to drop a PDFViewer on the same Window:

1. Use `system.report.executeReport` to generate the report and get the PDF bytes
2. Use PDFViewer’s `loadPDFBytes()` to load the bytes obtained in step 1
3. Use PDFViewer’s `print()` to the print the report

---

<div class="post-metadata">

**Author:** ![dominic.iannozzi](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dominic.iannozzi](https://forum.inductiveautomation.com/u/dominic.iannozzi)\
**Post date:** [January 13, 2026, 11:35am UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/4 "2026-01-13T11:35:51Z")

</div>

Hello Vi\_Quang,

Thankyou for your reply and the file you sent!

At runtime , I’m getting an error in the processSelectedItems() function at line 16 , “the object dataset is unscriptable…”

I debugged and the data is there…not sure what’s going on ; I am using Ignition V8.1.49

Thanks,

Dominic

---

<div class="post-metadata">

**Author:** ![Vi\_Quang](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/vi_quang/32/82707_2.png) [@Vi\_Quang](https://forum.inductiveautomation.com/u/Vi_Quang)\
**Post date:** [January 13, 2026, 4:23pm UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/5 "2026-01-13T16:23:49Z")

</div>

You have to convert the dataset to PyDataSet in 8.1. See the attached.

[report\_print\_from\_table\_selection\_solution\_1\_8.1.zip](https://forum.inductiveautomation.com/uploads/short-url/vo21xggVUNQxIhphZvhAWaoSms8.zip) (17.9 KB)

---

<div class="post-metadata">

**Author:** ![dominic.iannozzi](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dominic.iannozzi](https://forum.inductiveautomation.com/u/dominic.iannozzi)\
**Post date:** [January 14, 2026, 7:19am UTC](https://forum.inductiveautomation.com/t/report-viewer-refresh/113194/6 "2026-01-14T07:19:07Z")

</div>

Hello Vi\_Quang,

Excellent job! It’s working fine.

Thankyou for your support, much appreciated!
