How does logic work in report references

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:

@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.

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

Thanks in advance for your help,
Alex

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.

Thank you for the help.

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

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

1 Like