TimeStamp problem

30 views
Skip to first unread message

Marc Lang

unread,
May 21, 2012, 3:22:59 AM5/21/12
to InterSystems: Ensemble in Healthcare
I am missing something here, but have tried a few things and can't work out it.

Essentially, I want an object to persist with "Now" in the Created property.

Class SouthLabs.OrderNumberSet Extends (%Persistent, %XML.Adaptor)
{

Property PlacerOrderNumber As %String(MINLEN = 1);

Property HISSSetCode As %String;

Property TPSetCode As %String;

Property Created As %TimeStamp(XMLTIMEZONE = "IGNORE");

}


When trying to save it:

   set order.PlacerOrderNumber = ordernumber
   set order.HISSSetCode = hisscode
   set order.TPSetCode = tpcode
   set order.Created = $Now()
   set tsc = order.%Save()
   IF $$$ISERR(tsc) quit tsc

Status returned is 

0 ¤ ( 62598,26421.431015‚0 ~ ª "SouthLabs.OrderNumberSet:Created 62598,26421.431015<%ValidateObject+9^SouthLabs.OrderNumberSet.1

What's the best way to achieve this?

tirthankar bachhar

unread,
May 21, 2012, 3:37:30 AM5/21/12
to ensemble-in...@googlegroups.com, marc....@gmail.com
Instead of set order.Created = $Now()

You can try it with

set order.Created = $H



--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en



--
Tirthankar Bachhar
________________________________________________________
cell: +919331123037 | email: tirthanka...@gmail.com
--------------------------------------------------------------------------------------------------

eric

unread,
May 22, 2012, 4:42:14 AM5/22/12
to Ensemble-in...@googlegroups.com, InterSystems: Ensemble in Healthcare
Hi Marc,

The logical value of the %TimeStamp data type is in YYYY-MM-DD HH:MM:SS.nnnnnnnnn format. 

For example if you do :

w ##class(%Library.TimeStamp).DisplayToLogical($zdatetime($H,3,1,9))
the result is :
2012-05-22 10:39:06.000000000

See the documentation of $zdatetime for parameters to use.

Eric
Reply all
Reply to author
Forward
0 new messages