# How does logic work in report references

**URL:** <https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 13, 2023, 6:22pm UTC](https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582 "2023-01-13T18:22:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Elumbaugh](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Alex\_Elumbaugh](https://forum.inductiveautomation.com/u/Alex_Elumbaugh)\
**Post date:** [January 13, 2023, 6:22pm UTC](https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582/1 "2023-01-13T18:22:20Z")

</div>

I am struggling to explain how this logic works in a report key. For reference, I am coming into a project to make some updates, but I have never run into the idea of implementing logic in a report key before. If anyone could point me to a docs page or some other resources for understanding this, I would appreciate it.  
Here is the key value originally:

```auto
@RunHrs_Daily[24].EFFLUENT_SUMP_P1_HM < RunHrs_Daily[0].EFFLUENT_SUMP_P1_HM? (RunHrs_Daily.max.EFFLUENT_SUMP_P1_HM - RunHrs_Daily[0].EFFLUENT_SUMP_P1_HM + RunHrs_Daily[24].EFFLUENT_SUMP_P1_HM): (RunHrs_Daily[24].EFFLUENT_SUMP_P1_HM - RunHrs_Daily[0].EFFLUENT_SUMP_P1_HM)@

```

I am guessing that I would read like this if parsed into a python query, but I really don't know.

```auto
If 24hrs_ago < now:
               max - now + 24hrs_ago
else:
               24hrs_ago – now

```

Thanks in advance for your help,  
Alex

---

<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:** [January 13, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582/2 "2023-01-13T18:28:00Z")

</div>

Yes, that's how the ReportMill trinary operator "a?b:c" works (borrowed from C). `a` is treated as a boolean, and if true, `b` is evaluated to provide the result. Else `c` is evaluated. I'm not sure if this implementation "short-circuits" like it would in C.

---

<div class="post-metadata">

**Author:** ![Alex\_Elumbaugh](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@Alex\_Elumbaugh](https://forum.inductiveautomation.com/u/Alex_Elumbaugh)\
**Post date:** [January 13, 2023, 6:37pm UTC](https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582/3 "2023-01-13T18:37:20Z")

</div>

Thank you for the help.

---

<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:** [January 13, 2023, 6:46pm UTC](https://forum.inductiveautomation.com/t/how-does-logic-work-in-report-references/68582/4 "2023-01-13T18:46:06Z")

</div>

More documentation:  
[https://docs.inductiveautomation.com/display/DOC81/Keychain+Expressions#KeychainExpressions-ConditionalKeychainExample](https://docs.inductiveautomation.com/display/DOC81/Keychain+Expressions#KeychainExpressions-ConditionalKeychainExample)

> **[keychains.pdf](https://www.reportmill.com/support/keychains.pdf)**
>
> 73.27 KB

There's no mention of short-circuiting from RM, so it likely doesn't; something to consider.
