Question
Michael Lundberg · Apr 23, 2020

How to use classparameters?

Hello!

I'm not really familiar with how and if class parameters can be used during runtime or if it is static.

Class %TimeStamp has parameter XMLTIMEZONE [Constraint = "IGNORE, UTC", Flags = ENUM] = "UTC";

I wonder if that parameter can be changed to IGNORE during runtime and in that case how?

For the moment I have created my own type that inherits from %TimeStamp in order to change to IGNORE

 

Greetings Michael

0
0 176
Discussion (6)1
Log in or sign up to continue

Hi and thanks for your answer Robert.

I can now see that I was unclear about my question, I apologize for that

What I wanted is to see if it was possible to change
the value of parameter without changing the %TimeStamp class
or building a new class in my solution.

You should set it as your property parameter:

Class MyClass {

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

}

In runtime the behavior for your property CreatedOn would be IGNORE.

Hi and thanks for answer Eduard.

It did not work properly and it is still labeled as UTC in the SOAP request I send.
I.E 2019-09-12T10: 39: 00Z.  Maybe i'm doing something wrong. I dont' know.

Anyway, if I instead changed this type in my class from:
Property VisitTime As% TimeStamp (XMLNAME = "VisitTime"  , XMLPROJECTION = "ATTRIBUTE");

To:
Property VisitTime  As% TimeStamp (XMLNAME = "VisitTime " , XMLPROJECTION = "ATTRIBUTE", XMLTIMEZONE = "IGNORE");

it came out as 2019-09-12T10:39:00 (No Z at the end indicating UTC). And that's what I was looking for. However it can couse me trouble if the schema will be updated and i will lost my changes. And it would be easier to not change every %Timestamp-property in my class

VisitTime  (any property really) should be stored before property parameter change.

Can you try to recreate the data?

Hello

I don't think so. This is a proxy-class of type %SerialObject which I populate and embed in to the request class

/Michael