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)
DisplayToLogical converts external input to internal format.
if you have an object everything is internal already.
what would you expect to convert?
DisplayToLogical is just not involved in that process.
You may eventually look for LogicalToStorage - [a rare case]
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)
Thanks Sean,
I got it.