Use %Duration% with Formula Data Reference as Best Practice for EF Duration Attribute (AF 2017 R2+)

Idea created by bbregenzer Employee on Dec 18, 2018

    Originally posted on UserVoice

    This is a followup to discussions with Roger Palmen and Rick Davin about their excellent writeups on the topic of EF Duration attributes; see Event Frame duration - easy way in AF2.6 or higher & Duration attribute on an Event Frame - Part 1 , respectively.
    With the addition of the %Duration% substitution parameter and it's support in the Formula Data Reference, the following is suggested as a standard way to add a Duration attribute with values in a Time class UOM for newer versions of AF.
    Create an EF attribute template with the following configuration:

    Note 1: no parameters need to be defined; the substitution parameter is put directly into the Equation and can even be retrieved from the "helper" menus (red box and arrows).
    Note 2: As mentioned in Rick's blog, the Formula DR supports unit conversions so we can change the result in seconds produced by %Duration% to any other time class UOM (from seconds to hours in the example above; blue boxes).
    Note 3: A third method not shown here or the referenced articles, is use of EF Generation analysis outputs to add duration (see KB01884). Pro: this is a nice, all-in-one method if you also want to output the duration to a PI Pt attribute on the reference element. Cons: Because the output expressions are not evaluated until the EF closes, there are no intermediate Duration attribute values available for open EFs. This method seems more complex to configure.
    For further details/discussion, please see the comments under Rick's blog.
    Please vote/comment here to let everyone know what you think of this as a standard way to get EF duration into an EF attribute.
    Thanks for your time!

    Edit: It looks like some automated process to convert PI Square ideas to UserVoice entries removed the links & screenshots; added them back.