# Indirect Tag History Binding Expression

**URL:** <https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 5, 2024, 3:48pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836 "2024-03-05T15:48:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gillian\_Carter](https://avatars.discourse-cdn.com/v4/letter/g/8edcca/32.png) [@Gillian\_Carter](https://forum.inductiveautomation.com/u/Gillian_Carter)\
**Post date:** [March 5, 2024, 3:48pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/1 "2024-03-05T15:48:50Z")

</div>

I am trying to create an expression for an indirect history tag binding in perspective since there isn't the button option (which should be a feature).  
I have successfully created an indirect binding expression for a regular tag

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef49e46f491b00bf2b046a2e04e2e17e1c81fedf.png)  
However when I try to connect to the History Tag I get an Expression Eval Error  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/64af23682abff4c84b8ba286d1b9df4874b6a89f.png)  
In the docs they say to use this formatting for the tag path, but then I just get a Configuration Error, do I need an aggregation or an alias if I don't need to use them? What would I put in aggregate if I don't want it to be aggregated. I still get a Configuration Error anyway.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/0/50be337e9d22d25c781adda9b9627d381d260bc0.png)  
Please provide actual examples not just a link to the docs, I have read the docs and am still having issues

---

<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:** [March 5, 2024, 4:12pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/2 "2024-03-05T16:12:08Z")

</div>

When you hover over Error\_Expression what message is displayed?

---

<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:** [March 5, 2024, 4:24pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/3 "2024-03-05T16:24:03Z")

</div>

I think there's two fundamental things that you're missing, one of which is (in my opinion) really, really bad UX on our part.

1. The 'Expression' mode for a tag history binding expects you to author an expression **that returns a well formatted tag history configuration object**. Since you currently _cannot_ \[1\] create arbitrary array and object literals in expressions, your tag history binding expression **must** point to some other custom property literal. There's literally no other way to use expression mode.

2. You **must** specify an aggregation function when working with our historian. The historian _always_ uses some kind of compression when storing literal values \[2\]. The aggregation mode used in your tag history binding is _either_ the 'Query Mode' you specify in the dropdown at the top, _or_ the aggregation function defined per tag. If you don't want to specify an aggregation mode, just omit the key in the object you're returning via the expression. Fair play - I didn't know that it was possible to do that until I dug into the code just now.

* * *

1. without custom modules, see @pturmel's Integration Toolkit module 

2. 

> **[How the Tag Historian System Works | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/tag-historian/how-the-tag-historian-system-works#deciding-when-to-store)**
>
> This page provides an overview on how the Tag Historian system evaluates tag changes, stores them, and later retrieves those values.

---

<div class="post-metadata">

**Author:** ![Gillian\_Carter](https://avatars.discourse-cdn.com/v4/letter/g/8edcca/32.png) [@Gillian\_Carter](https://forum.inductiveautomation.com/u/Gillian_Carter)\
**Post date:** [March 6, 2024, 3:13pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/4 "2024-03-06T15:13:51Z")

</div>

With just the tag string I get the expression error which I assume is telling me I need to do the full list

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/a/3a7def1e41294d85eca5a3c9a34a82a7e98b0e99.png)  
I'm getting this configuration error talking about the left bracket. I am also getting it on a different binding too which is just a single property from the view, shown below.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/1/41b015a70fda0c4a55d7d888a5451c45807720f6.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c7bb536fee15e55ec9a8b238c895d4d76fe42ab6.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:** [March 6, 2024, 3:31pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/5 "2024-03-06T15:31:44Z")

</div>

Sorry, I don't know and I can't experiment at the moment.

---

<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:** [March 6, 2024, 4:03pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/6 "2024-03-06T16:03:15Z")

</div>

> [@Gillian\_Carter](#):
>
> I get the expression error

Go back and read PGriffith's reply again. You simply **cannot** construct lists of maps in an expression binding using jython syntax. **Not supported.**

If you install my Integration Toolkit module, you could use the following expression:

```auto
asList(
	asMap(
		'aggregate', 'Average',
		'alias', 'Cycle Time',
		'path', '[SQLServer/ignition-srv-mnet:default]oee/modbus/074/35/cycle_time'
	)
)

```

If you don't use my module, you must construct the correct list of maps in a separate property, and reference that separate property in the binding.

---

<div class="post-metadata">

**Author:** ![Gillian\_Carter](https://avatars.discourse-cdn.com/v4/letter/g/8edcca/32.png) [@Gillian\_Carter](https://forum.inductiveautomation.com/u/Gillian_Carter)\
**Post date:** [March 8, 2024, 7:08pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/7 "2024-03-08T19:08:32Z")

</div>

Where should I put this other custom property literal (should it be a custom property?) ? and can you provide an example of what would be in this property (would it be the list and I just have to reference it)?  
I tried creating a custom property and referencing it, now I get a Expression Error. The docs just said to copy paste it, but I assume I need to change the array structure

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

---

<div class="post-metadata">

**Author:** ![Gillian\_Carter](https://avatars.discourse-cdn.com/v4/letter/g/8edcca/32.png) [@Gillian\_Carter](https://forum.inductiveautomation.com/u/Gillian_Carter)\
**Post date:** [March 8, 2024, 8:17pm UTC](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/8 "2024-03-08T20:17:05Z")

</div>

This discussion helped by providing examples in their replies  
[Sparkline Dynamic Tag History Expression Binding - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/sparkline-dynamic-tag-history-expression-binding/44008)
