Skip to main content

The Length Property as %Integer

When you add a property to a class, the system automatically adds a pair of new methods to your class named PropertyNameLogicalToDisplay and PropertyNameDisplayToLogical. These methods preserve the behavior of the LogicalToDisplay and DisplayToLogical methods in the datatype class. So, if we add a Length property of type %IntegerOpens in a new tab to Film, then Caché will automatically add the methods LengthLogicalToDisplay and LengthDisplayToLogical to Film. These methods will provide the default behavior of %IntegerOpens in a new tab's LogicalToDisplay and DisplayToLogical.

generated description: newlengthlogicalanddisplay.jpg

To implement our custom display format for Length values, we would need only re-define the LengthLogicalToDisplay method inside Film. Any of Caché's tools and utilities that automatically use this method to display Length values will display them the way that we want them displayed rather than the way that Caché usually displays %IntegerOpens in a new tab values.

Caché, however, provides us with an even better option...

Note:

Note: The Studio Inspector does not display either the PropertyNameLogicalToDisplay or the PropertyNameDisplayToLogical method.

FeedbackOpens in a new tab