# Report data source script access to element of another data source

**URL:** <https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507>\
**Category:** Ignition\
**Tags:** reporting, ignition81, scripting\
**Created:** [May 13, 2026, 10:52am UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507 "2026-05-13T10:52:35Z")\
**Posts on this page:** 7\
**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:** [May 13, 2026, 10:52am UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/1 "2026-05-13T10:52:35Z")

</div>

My report has a query data source of the form,

```python
SELECT TOP 1 VALUE 
FROM my_table 
WHERE orderNum = ?

```

On the report Design tab it shows up in the Data Sources:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9d0be97ca2332b749b426f3cb8c60de1c43a2503.png)

I want to script a derived value. How do I access InnerLabel.VALUE from my script? I've tried variations of

```python
    innerLabel = data['InnerLabel'].getCoreResults().getValueAt(0, 'VALUE')
    data['InnerLabelGTZero'] = innerLabel

```

but `InnerLabelGTZero` doesn't appear in the Data Sources list. I suspect that I'm not accessing VALUE correctly. (`type(data['InnerLabel'])` seems to be a 'class'.)

Any ideas? Thanks!

---

<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:** [May 13, 2026, 11:28am UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/2 "2026-05-13T11:28:29Z")

</div>

Huh. Did you configure `InnerLabel` as a scalar query?

---

<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:** [May 13, 2026, 11:42am UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/3 "2026-05-13T11:42:21Z")

</div>

Hi, Phil.

No, I'm using a Report Data SQL query and that's not an option - is it?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/373227a9fa3cbc045cb08fafdad353826ce9dd90.png)

---

<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:** [May 13, 2026, 11:53am UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/4 "2026-05-13T11:53:33Z")

</div>

Hmm. Conflated with UI bindings. Sorry.

I think what I'm seeing is no row returned at all.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [May 13, 2026, 1:03pm UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/5 "2026-05-13T13:03:42Z")

</div>

I just threw this together and it worked right off the bat

```python
data['tbegin'] = data['query2'].getCoreResults().getValueAt(0,'TimeBegin')

```

Where query2 is a simple

`select top 1 ['TimeBegin'],['TimeEnd'] from table`

I am with Phil in I think your select isn't returning a row?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/34b1bc500af35b441c4894c0660359a64e6a3795.png)

---

<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:** [May 13, 2026, 1:43pm UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/6 "2026-05-13T13:43:53Z")

</div>

> [@MMaynard](#):
>
> I am with Phil in I think your select isn't returning a row?

I suspect you're both right. I'm finding debugging in Reports a bit tedious!

---

<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:** [May 13, 2026, 2:51pm UTC](https://forum.inductiveautomation.com/t/report-data-source-script-access-to-element-of-another-data-source/115507/7 "2026-05-13T14:51:31Z")

</div>

A common pitfall is to override the builtin `data` variable inside a report script. Similar to using `system` for a variable name in a script.

Probably not your issue, but good to be aware of.
