Hi,
I wanted to use a custom attribute whose base type is Timestamp. But it seems after applying the value through script (Macro or Report) the attribute does not works like default Timestamp attributes, i.e. it does not converts the time to local time. Here is the testing i did,
My Location : India (GMT +5.30)
ARIS server : Chicago (GMT -6.00)
1. Created an attribute "Test" with base type "Point In Time | Constants.ABT_TIMESTAMP" which holds the value like e.g. "Feb 3, 2012 05:00:00 PM"
2. I wanted to set this attribute to a model with current time.
Suppose my current time is "Feb 3, 2012 05:00:00 PM IST (GMT +5.30)"
3. If I set the value using Macro, it sets the time in GMT 0.00. So the value of attribute becomes "Feb 3, 2012 11:30:00 AM", i.e. -5.30 from my current time, which means my current value was converted to GMT 0.00
var g_Attribute = Context.getArisMethod().UserDefinedAttributeTypeNum("9f67ef70-4e4e-11e1-65d5-005056863358"); var g_Model = Context.getSelectedModels()[0]; var g_LoginInfo = Context.getLoginInfo(g_Model); Designer.setAttributePersistent(g_Model, g_Attribute, java.util.Date(), g_LoginInfo.getLoginLanguage());
So from my location i see the values
"Test" = "Feb 3, 2012 11:30:00 AM" (seen as GMT 0.00)
"Last Change" = "Feb 3, 2012 05:00:00 PM", (seen in local timezone GMT +5.30)
and if i go to server, and see the value it also shows
"Test" = "Feb 3, 2012 11:30:00 AM" (seen as GMT 0.00)
"Last Change" = "Feb 3, 2012 05:30:00 AM", (seen in server Timezone GMT -6.00)
4. If I set the value using Report (server side script). Report sets the value in server time zone ("Feb 3, 2012 05:30:00 AM") as report is server side script and it runs on server.
var g_Attribute = ArisData.ActiveFilter().UserDefinedAttributeTypeNum("9f67ef70-4e4e-11e1-65d5-005056863358"); var g_Model = ArisData.getSelectedModels()[0]; g_Model.Attribute(g_Attribute, Context.getSelectedLanguage()).setValue(new Date());
After setting the same value through report, I see the values from my location
"Test" = "Feb 3, 2012 5:30:00 AM" (seen as GMT -6.00)
"Last Change" = "Feb 3, 2012 05:00:00 PM" (seen as GMT +5.30)
If I go to server and see values
"Test" = "Feb 3, 2012 5:30:00 AM" (seen as GMT -6.00)
"Last Change" = "Feb 3, 2012 05:30:00 AM" (seen as GMT -6.00)
>
The problem here is, it never works like "Last Change" attribute (which shows the value in respective timezones), instead it seems to be a fixed "Text" value attribute
If I set the value through Macro it will set the value (Your current time or provided time - GMT constant), and if I set the value through Report it will set the value to (Server time). And then you see the value from any location it will show you the same value, instead of value specific to your timezone.
Can't we have an custom attribute with same behaviour like "Last Change" or "Time of Generation". Any help on this will be great. I am using ARIS Server 7.1 SR9.
Thanks & Regards,
Amol Patil
Hi Amol,
there are only 3 time stamp attributes which are time-zone dependent:
AT_CREAT_TIME_STMP
AT_LAST_CHNG_2
AT_TIME_STAMP
For time-zone dependent attributes the report already adds/subtracts the time zone difference (using the client's time zone) before returning a value and before setting a value.
BR,
Torsten
Hi Torsten,
Then i think there is no way we can have more such attributes. Actually, timestamp / date / time attributes should always be timezone dependent. If they are not then there is no difference between text and those attributes data types.
The problem here is, if user has to see those custom attributes then the ARIS designer shows them in server timezone without GMT string, and user might not know the server timezone to do the conversion manually.
So, now I am using text attribute to store timestamp, in which I can store the timestamp with complete GMT string.
Thanks,
Amol Patil