Question
· Mar 11, 2021

DisplayToLogical

Is there any reason that property method  DisplayToLogical() is not calling before object saving?

I have such situation and do not know how it is possible

Product version: Caché 2018.1
Discussion (3)0
Log in or sign up to continue

Hello Ruslan, 

You are correct, DisplayToLogical() is not called automatically when saving an object. When you are manipulating an object using ObjectScript, the assumption is that the value you are dealing with is already a logical value. If you need to convert from a display value, you can do so explicitly. For instance, if you have a the following class:

Class Test.MyClass Extends %Persistent
{
Property MyDate As %Date;
}

You can convert from display to internal using either of the following:

set myobj = ##class(Test.MyClass).%New()
set myobj.MyDate = ##class(%Date).DisplayToLogical(value)
set myobj.MyDate = ##class(Test.MyClass).MyDateDisplayToLogical(value)