Defining the Length Property
Now, let's turn our attention to the Length property. This property represents the length of a film in minutes. We would like to store Length values as simple integers, but display them as strings formatted to show both the number of hours and the number of minutes in a film length. For example, if a film is 117 minutes long we would like to store the value as 117 while displaying it as 1h57m. Storing Length values as integers makes calculations easier and faster while displaying them as strings with this extra formatting is much friendlier to our users.
In Caché terminology, we call the storage format the “logical format” and we call the display format simply the “display format”. Caché converts between these formats with a pair of methods: LogicalToDisplay and DisplayToLogical. (Remember that “methods” are functions or code included in a class definition.) Every Caché datatype class, %IntegerOpens in a new tab, %FloatOpens in a new tab, and %DateOpens in a new tab, for example, contains a pair of these methods. For more on using LogicalToDisplay and DisplayToLogical read Using Caché Objects: Data types .