# Perspective Tag History binding - collecting Duration On , on conditions of two Tags

**URL:** <https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [June 25, 2024, 7:09pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358 "2024-06-25T19:09:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 25, 2024, 7:09pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/1 "2024-06-25T19:09:38Z")

</div>

We've done a lot of tag history binding, collecting time duration, historical mode (8 hour shift) of single boolean tag conditions.

I have the need to do so on a specific condition of two (Boolean) tags - AUTO = True And ACTIVE = False. A waiting state and we want to return the duration of that. I'm not finding quite the right combination. Per the screen shot, I'm trying the Expression mode, but I've been using the Direct mode with single Tags, using a Calculation of DurationOn (or Off). I must be close, or what's the best way to capture this? Thanks!

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/f/df60374ee168d35757ca250381fc7ef0654ea0a5.jpeg)

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 25, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/2 "2024-06-25T19:20:09Z")

</div>

I suppose I could create a new tag that is an expression tag that is the evaluation of those two in that state, and then collect duration on that as I've done the others. That would solve the problem. It would still be nice to see how it could be done here :).

---

<div class="post-metadata">

**Author:** ![Mark\_Minuth](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mark\_Minuth](https://forum.inductiveautomation.com/u/Mark_Minuth)\
**Post date:** [June 25, 2024, 7:32pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/3 "2024-06-25T19:32:06Z")

</div>

I believe the equals comparison in expression language is just the single `=` instead of `==`  
Also worth noting that that expression could probably be simplified, as right now it essentially reads "If argument, then true, else false", and could probably be replaced with just the argument, something like `{[PLR_Tags]AUTO} && !{[PLR_Tags]PULLER_ACTIVE}`

---

<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:** [June 25, 2024, 9:21pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/4 "2024-06-25T21:21:50Z")

</div>

The historian is not designed to do any such analysis across multiple tags, whether booleans or not. The expression tag is the right answer for simple cases. For more complex cases, you almost certainly need wide tables (SQL Bridge or manually scripted) with triggering logic.

---

<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:** [June 25, 2024, 9:37pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/5 "2024-06-25T21:37:05Z")

</div>

In addition to all these other things, expression mode in a tag history binding doesn't work the way you're attempting to. The expression you author needs to return a well-formatted array of objects that describe the tags you want to return history for.

See the first bullet here:

> [@Indirect Tag History Binding Expression](https://forum.inductiveautomation.com/t/indirect-tag-history-binding-expression/86836/3):
>
> 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. 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]](#footnote-329286-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 expressi…

---

<div class="post-metadata">

**Author:** ![jeff.ryan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jeff.ryan/32/25543_2.png) [@jeff.ryan](https://forum.inductiveautomation.com/u/jeff.ryan)\
**Post date:** [June 26, 2024, 1:04pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-history-binding-collecting-duration-on-on-conditions-of-two-tags/92358/6 "2024-06-26T13:04:10Z")

</div>

Thanks all. Now I have a better understanding and will know how to handle in the future, for this one (expression tag).
