Using a cast in a metric for checking the typeIdent of a party role


Sometimes it is necessary to check what type a PartyRole type is associated with, and one of the ways to do this is to execute a filter on it, e.g. partyRole.(typeIdent == “PR:Truck”).otherType

One way to get around stale data when doing this is to directly cast the typeIdent check against the type instead of against a static string, e.g. partyRole.Truck.otherType

This works fine in stored calcs, however, when trying to do this in an analytic (for the value in a TSDecl) the pathing does not seem to function correctly. The value is set up as such: “value”: “parent.partyRole.CastType ? 1 : 0”

The error given is:

Field ‘CastType’ does not exist on type ‘CastType’ on expression 'parent.partyRole.CastType ? 1 : 0

Is this behavior supported for an analytic?



Type casting is not currently supported in metric expressions. See potential workaround here: