# Can I use runScript() in Reporting parameter default?

**URL:** <https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102>\
**Category:** Ignition\
**Tags:** perspective, ignition83, reporting\
**Created:** [September 16, 2026, 1:06pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102 "2026-09-16T13:06:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 16, 2026, 1:06pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102/1 "2026-09-16T13:06:14Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/b/1bc1e97014050bdd130ba0bfd856acd0670387ec.png)

- The expression works correctly when I use it in an expression binding on a Perspective custom property. The dataset is returned.
- When I try it in the report parameters as shown above I get,  
`WARN: Error parsing default value expression for parameter "reportColors" -- Error executing script for runScript() expression:Report_Functions.reportColors`

I can't find any documentation to say that `runScript()` won't work here.

Any ideas?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 16, 2026, 1:09pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102/2 "2026-09-16T13:09:48Z")

</div>

Does `Report_Functions` exist in your gateway scripting project?

---

<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:** [September 16, 2026, 1:11pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102/3 "2026-09-16T13:11:21Z")

</div>

> [@dkhayes117](#):
>
> gateway scripting project?

Should not matter. Reports are part of a project, and that project's library is in scope.

Sounds like a bug.

As a workaround, use a script data source to make the call and assignment.

---

<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:** [September 16, 2026, 3:35pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102/4 "2026-09-16T15:35:40Z")

</div>

I don't see any reason why this shouldn't work, from a glance at the code. Should be using a project specific script manager, as you'd expect. Indeed sounds like a bug 🤷

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 16, 2026, 9:03pm UTC](https://forum.inductiveautomation.com/t/can-i-use-runscript-in-reporting-parameter-default/117102/5 "2026-09-16T21:03:30Z")

</div>

I opened a support ticket and was then offline for a few hours. I came back to it, created a new minimalist project, go that working. I compared with the original project and it seemed the same. I must have changed something as it's working now. I've closed the ticket.

For anyone interested in having master styles for all their reports:  
In `Project Library` I created `Report_Functions` with this code:

```python
def reportColors():
	# Generate a list of standard colors for the reports.
	# Generating a dataset allows all the colors to be passed through in one parameter.
	headers = ['name', 'color']
	data = []
	data.append(["colorHeadingBg", "#002288"])
	data.append(["colorHeadingText",	"#FFFFFF"])
	data.append(["colorTableHeadBg",	"#777777"])
	
	return system.dataset.toDataSet(headers, data)

```

In the report, retrieve the reportColors dataset:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/4/94628a0bde883d562319a931befa39bba598e5bc.png)  
`runScript("Report_Functions.reportColors")`

Then extract each of the colors as follows:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/d/5de08471d3688d21483d172aa9fff3f5edd08b94.png)

- colorHeadingBg: `toColor({reportColors}[0, 1])`
- colorHeadingText: `toColor({reportColors}[1, 1])`
- colorTableHeadBg: `toColor({reportColors}[2, 1])`

Finally, use them by adding Dynamic Data Key in the component's properties.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/8/c8cfd6680d129a8f2312e4fa5029c1ca2bd83573.png)

Unfortunately the Design tab doesn't reflect the changes but the Preview tab does.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b532cf4e808012a0e507c32c727617a71c515907.png)

Thanks, all.
