# Example request - Update Props.dataSources via script

**URL:** <https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [April 10, 2026, 6:37pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011 "2026-04-10T18:37:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 6:37pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/1 "2026-04-10T18:37:15Z")

</div>

Please help me with an example using a script to call a namedquery, and parse that data into new dataset with additional logic.

I am struggling with understanding how to update an XY Chart’s Props datasource with the new dataset via script.

Maybe with onload event.

---

<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:** [April 10, 2026, 6:43pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/2 "2026-04-10T18:43:19Z")

</div>

Best place to get started is to head over to IA university, there is a shortcut at the top of the page. Go over Ignition Scripting videos to get your feet wet. Once you watch those, come back with your first attempt with any questions.

The user manual is very helpful as well, also linked at the top of the page.

[Scripting Functions](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions)

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 7:03pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/3 "2026-04-10T19:03:12Z")

</div>

Not a single example of this in all the IU classes. do you know a good way to do what was mentioned in OP?

---

<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:** [April 10, 2026, 7:05pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/4 "2026-04-10T19:05:16Z")

</div>

Give us something to work with. Attach a script where you've at least tried to call a named query, and we can go from there.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 7:06pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/5 "2026-04-10T19:06:42Z")

</div>

The named query is not the issue. I need the dataset to be pushed into the datasource:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/0/204247f7e2e6c49d6984947b698d604ce63fd1a5.png)

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 7:08pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/6 "2026-04-10T19:08:24Z")

</div>

This must be simple…. I am just missing something small I am sure.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 7:09pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/7 "2026-04-10T19:09:50Z")

</div>

Use the XY Chart Gantt example dictionary as the dataset…. how to I update the datasouce with a script?

> [  
> {  
> "name": "John",  
> "fromDate": "2018-01-01 08:00",  
> "toDate": "2018-01-01 10:00",  
> "color": "#00FF30"  
> },  
> {  
> "name": "John",  
> "fromDate": "2018-01-01 12:00",  
> "toDate": "2018-01-01 15:00",  
> "color": "#FF0030"  
> },  
> {  
> "name": "John",  
> "fromDate": "2018-01-01 15:30",  
> "toDate": "2018-01-01 21:30",  
> "color": "#00FF30"  
> },  
> {  
> "name": "Jane",  
> "fromDate": "2018-01-01 09:00",  
> "toDate": "2018-01-01 12:00",  
> "color": "#00FF30"  
> },  
> {  
> "name": "Jane",  
> "fromDate": "2018-01-01 13:00",  
> "toDate": "2018-01-01 17:00",  
> "color": "#FF0030"  
> },  
> {  
> "name": "Peter",  
> "fromDate": "2018-01-01 11:00",  
> "toDate": "2018-01-01 16:00",  
> "color": "#00FF30"  
> },  
> {  
> "name": "Peter",  
> "fromDate": "2018-01-01 16:00",  
> "toDate": "2018-01-01 19:00",  
> "color": "#00FF30"  
> }  
> ]

---

<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:** [April 10, 2026, 7:12pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/8 "2026-04-10T19:12:04Z")

</div>

Let's start with getting the named query data into the property. The best way to do this is with a named query binding. Beside the data property, there will be a little chain link icon that when clicked on, will allow to choose between different binding types. Click on the query one, and put in your path and parameters.

EDIT: Do not put the binding on the `dataSources` prop but on one of the values under it, IE `schedule_data`.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [April 10, 2026, 7:14pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/9 "2026-04-10T19:14:09Z")

</div>

forget the namedquery part… lets just go from dataset or pydataset to chart props datasource. That is the missing part. How to I update the Chart properties(datasource specifically) from a script. Thanks.

---

<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:** [April 10, 2026, 7:17pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/10 "2026-04-10T19:17:31Z")

</div>

The easiest way, but has a little more overhead than others, is to bind the named query to the specific data source, then in that binding, add a transform. It is a button that is visible in the same popup where you configure the binding.

Use a script transform on the binding to manipulate the data as needed. Anytime the NQ binding updates, the transform will subsequently run.

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

---

<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:** [April 10, 2026, 7:23pm UTC](https://forum.inductiveautomation.com/t/example-request-update-props-datasources-via-script/115011/11 "2026-04-10T19:23:17Z")

</div>

For best performance, I use Phil's [Integration Toolkit](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934) (3rd party module) that enables data looping in expressions along with other features. This dodges the scripting interpreter overhead.
