# Am I going about this in the wrong way

**URL:** <https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [February 11, 2026, 5:06pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906 "2026-02-11T17:06:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 5:06pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/1 "2026-02-11T17:06:29Z")

</div>

I wanted to make a library view that I could quickly drop inside of a tab view and simply add a param to define a WellNumber. I initially tried to find a way to bind a time series chart data to a view.params.WellNumber using a Tag History. But I found no way to do something like this inside of Expressions: {[default]_AllenBradley_/Controller:Global/W{view.params.WellNumber}\_Well\_Pressure}. So I made a script in my library which builds all the tags from the param and fills in 8 graphs when a DateTime Input is changed.

That all works great. Where I am now stumped is I would like there to be a Real Time toggle button. If it is true, I’d like to count say 10 seconds and then run the query function and load the data again. I see no way of achieving this repeating function timer though.

Is there a better way of doing this or is this kind of functionality not possible? I would think it was possible because other browser javascript tools have found a way to setup repeating timer functions like ReactQuery.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [February 11, 2026, 5:18pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/2 "2026-02-11T17:18:50Z")

</div>

You should be using the `runScript` expression to run your library script. The second parameter is `pollRate` which you can use to make it run repeatedly at a given interval.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 11, 2026, 5:26pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/3 "2026-02-11T17:26:59Z")

</div>

None of what you are attempting should require a script.

> [@joshua.edwards.navy](#):
>
> {[default]_AllenBradley_/Controller:Global/W{view.params.WellNumber}\_Well\_Pressure}

Create an array custom property on the view(make its access private). Each value in the array should be a dictionary with the members `tagPath` and `aggregationMode`. For each tag path, add the following expression: `"[default]AllenBradley/Controller:Global/W" + {view.params.WellNumber} + "_Well_NeededItemHere"`.  
Adjust `NeededItemHere` to be whatever tag you want from the well. Doing that should give you an array of objects that are accepted by a tag history binding.

From there, feed that array to the expression of a tag history binding on another custom property, and then bind that historical data to a time series chart. [Tag history](https://www.docs.inductiveautomation.com/docs/8.3/ignition-modules/perspective/working-with-perspective-components/bindings-in-perspective/tag-history-bindings-in-perspective) bindings have a poll rate that is configurable, so you could set it to 10s.

If you had the [Integration Toolkit](https://forum.inductiveautomation.com/t/automation-professionals-integration-toolkit-module/74934) module installed you could have 2 custom properties, `baseTagPath` and `requiredWellMembers`, and use those to create the array automatically with an expression of

```python
forEach(
   {view.custom.requiredWellMembers},
   asMap(
       "tagPath", {view.custom.baseTagPath} + {view.params.wellNumber} + it(),
       "aggregationMode", "MinMax"
   )
)

```

Additionally, your Ignition tag names should not be the same as your PLC tag path. Rename and organize them in a way that benefits your UI design. Use UDTs and/or folders to group accordingly, regardless of where the tags exist in the PLC.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 5:44pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/4 "2026-02-11T17:44:54Z")

</div>

runScript in a runAction is giving me a NameError: global name 'runScript' is not defined.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [February 11, 2026, 5:51pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/5 "2026-02-11T17:51:56Z")

</div>

`runScript` is an expression, not a script function.

> **[runScript | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.3/appendix/expression-functions/advanced/runScript?utm_term=&utm_campaign=002+Ignition+Performance+Max&utm_source=adwords&utm_medium=ppc&hsa_acc=1942977828&hsa_cam=19829025962&hsa_grp=&hsa_ad=&hsa_src=x&hsa_tgt=&hsa_kw=&hsa_mt=&hsa_net=adwords&hsa_ver=3&gad_source=1&gad_campaignid=23536043753&gbraid=0AAAAAD-80zh8DWC_r80NefIyMXd493E-Y&gclid=Cj0KCQiA7rDMBhCjARIsAGDBuECugUTONAINaEiS8sFOD2Lnh_JmG9mr1hlHLawJ7qCYP9RDRrmXb8EaAvUWEALw_wcB)**
>
> Runs a single line of Python code as an expression.

---

<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:** [February 11, 2026, 6:02pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/6 "2026-02-11T18:02:38Z")

</div>

Have you already gone through or at least skimmed [IU](https://inductiveuniversity.com/)? I feel like you're laser focused on "I have this one problem and I believe the solution to it is X", but you might need to take a step back and re-evaluate.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 6:07pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/7 "2026-02-11T18:07:32Z")

</div>

Your way sounds like the most logical and makes it as automated as possible so someone else just has to enter baseTagPath and requiredWellMembers like you mentioned.

I’ll try this and report back if I got it to work.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 6:18pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/8 "2026-02-11T18:18:23Z")

</div>

So bind each chart to run a script with inputs for tag built by concat the vision.params with the rest of that tag format, beginningTime, endTime, and the status of real time toggle? This seems less than straight forward. Probably doable though.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 6:27pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/9 "2026-02-11T18:27:01Z")

</div>

I’ve tried a couple of ways. I didn’t see anything on IU that seemed to cover this in the Core. Chatgpt recommended something like ryan.white suggested, but it recommended make the key: value object for each graph each time. So I tried it with a way I came up with. It pretty much works except when I wanted to implement the ability to add polling. Otherwise my method worked great. I could probably change it to an Update button that runs the script.

My view could be dropped into another view and only needed 1 input and would work with all of our tags.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 11, 2026, 6:47pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/10 "2026-02-11T18:47:40Z")

</div>

How would I take into account the real time toggle button to change Tag History from Realtime or historical?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 12, 2026, 11:04pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/11 "2026-02-12T23:04:48Z")

</div>

Always run in historical mode and bump the span start and end at your desired rate. You can have 2 additional custom properties, one with an expression of `now(10000)` and one with an expression of `addHours({self.view.custom.currentTs}, -6)` or similar(adjust to your desired span).

If you want to pause the time, you can tweak the first custom property to be `now(if({self.view.custom.enableRealtime}, 10000, 0))`. Be warned this will still execute once on transition to stopped.

Feed these two properties to the start and end dates of the tag history binding. It might be worth it to truncate any milliseconds off those two properties to keep start and end times on exact seconds. Something like `addMillis({view.custom.key}, -1 * getMillis({view.custom.key}))` should work.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 24, 2026, 9:27pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/12 "2026-02-24T21:27:02Z")

</div>

I’ve gotten pretty close with this solution. The only issue I’ve ran into is that forEach returns a list. So when I go to my timeseries graphs to do a tag history binding, I bind it to 0, 1, 2, 3, etc. I’ve tried a couple of different things. The closest I got was:

```python
forEach(
	{view.params.tagInfo}, 
	asMap(it()["tagEnding"], asMap(
			"tagPath", {view.params.baseTagPath} + {view.params.WellNumber} + "/" + it()["tagEnding"],
			"agg", it()["agg"],
			"type", it()["type"]
		)
	)
)

```

this results in a list with a [key: {key: value, key: value}], but it’s still a list that’s accessed 0, 1, 2, etc.

I’ve been trying to get tagData: {key: {key: value, key: value}, etc }. I thought the solution might be orderBy, but when I tried:

```python
orderBy(
	{view.params.tagInfo}, 
	asMap(it()["tagEnding"], asMap(
			"tagPath", {view.params.baseTagPath} + {view.params.WellNumber} + "/" + it()["tagEnding"],
			"agg", it()["agg"],
			"type", it()["type"]
		)
	)
)

```

I get an ExpressionEval error.

---

<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:** [February 24, 2026, 9:49pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/13 "2026-02-24T21:49:27Z")

</div>

`orderBy()` doesn't construct new mapping objects, it just filters a list into a shorter list. Its arguments after the source data are conditional expressions.

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 24, 2026, 9:51pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/14 "2026-02-24T21:51:12Z")

</div>

Is there anyway to create an object {key: {key: value, key: value} } or should I just bind my graphs to the list and be careful to never reorder the tag data?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 24, 2026, 10:09pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/15 "2026-02-24T22:09:21Z")

</div>

Building on the original example I gave:

```python
asMap(
	asPairs(
		forEach(
			{view.custom.requiredWellMembers},
			asList(
				it(),
				asMap(
				   "tagPath", {view.custom.baseTagPath} + {view.params.wellNumber} + it(),
				   "aggregationMode", "MinMax"
				)
			)
		)
	)
)

```

This is assuming you are using the required members as the driving key for the map. Otherwise you'll have to change the first `it()` after `asList` to something that will yield a unique key for each tag

> **Application Result**
>
> a source array of
> 
> ```python
> [
> "valueA",
> "valueB",
> "valueC",
> "valueD"
> ]
> 
> ```
> 
> yields
> 
> ```python
> {
> "valueB": {
> "tagPath": "tagPathvalueB",
> "aggregationMode": "MinMax"
> },
> "valueA": {
> "tagPath": "tagPathvalueA",
> "aggregationMode": "MinMax"
> },
> "valueD": {
> "tagPath": "tagPathvalueD",
> "aggregationMode": "MinMax"
> },
> "valueC": {
> "tagPath": "tagPathvalueC",
> "aggregationMode": "MinMax"
> }
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![joshua.edwards.navy](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@joshua.edwards.navy](https://forum.inductiveautomation.com/u/joshua.edwards.navy)\
**Post date:** [February 24, 2026, 10:25pm UTC](https://forum.inductiveautomation.com/t/am-i-going-about-this-in-the-wrong-way/113906/16 "2026-02-24T22:25:02Z")

</div>

Yes that did it. Now I am able to bind my graphs to custom tagData.
