go to post Vitaliy Serdtsev · Feb 2, 2017 It seems to me that in this case is not well suited %SerialObject.Will be easier to use %List.
go to post Vitaliy Serdtsev · Feb 2, 2017 > Can I make a serial class always computed?Yes, of course.Class CS.Serial Extends %SerialObject [ NoExtent ]{Property Year As %Integer;Property Month As %Integer;}Class CS.Persistent Extends %Persistent{Property data As CS.Serial [ SqlComputeCode = {set {*} = ##class(CS.Persistent).dataGetStatic()}, SqlComputed, Transient ];ClassMethod dataGetStatic() As %List{ quit $lb(2017,1)}}Output:^CS.PersistentD=1^CS.PersistentD(1)=$lb("")ID data1 $lb(2017,1) 1 Rows(s) Affected
go to post Vitaliy Serdtsev · Feb 2, 2017 It all depends on what you wish to achieve.For example:Class CS.Serial Extends %SerialObject{Property Year As %Integer;Property Month As %Integer;Method %MyGetSerial() As %List [ ServerOnly = 1 ]{ q $lb(i%Year,i%Month)}}Class CS.Persistent Extends %Persistent{/// Property is triggered computedProperty data1 As CS.Serial [ SqlComputeCode = {set {*} = ..dataGetStatic()}, SqlComputed ];/// Property is always computedProperty data2 As %List [ SqlComputeCode = {set {*} = ##class(CS.Persistent).dataGetStatic()}, SqlComputed, Transient ];/// data getter method in SQL contextClassMethod dataGetStatic() As %List{ s s=##class(CS.Serial).%New(), s.Month=1, s.Year=2017 q s.%MyGetSerial() ; or q $lb(2017,1)}}---------select ID,data1,data2,data1_Month,data1_Year from CS.PersistentID data1 data2 data1_Month data1_Year1 2017,1 2017,1 1 20172 2017,1 2017,1 1 20173 2017,1 2017,1 1 2017
go to post Vitaliy Serdtsev · Jan 25, 2017 Try to use high level interface to work with sockets: %IO.Socket, %IO.SocketCommon.Look on %SYSTEM.INetInfo.Connected() [aka $ZUTIL(189)] or you can use tools of OS [for example see source code %SYSTEM.INetInfo.CheckAddressExist()]
go to post Vitaliy Serdtsev · Jan 16, 2017 See /csp/samples/timer.csp in SAMPLESNote: by timeout you can run any method: on the client side (javascript) and/or on the server side (COS).
go to post Vitaliy Serdtsev · Jan 13, 2017 # 1d ##class(%ListOfDataTypes).BuildValueArray($lfs("a,b,c,d,e,f"),.array)s array(0)=$o(array(""),-1)zw array# 2s list=##class(%ListOfDataTypes).%New()d list.InsertList($lfs("a,b,c,d,e,f"))m array=list.Datas array(0)=list.Count()zw arrayThe Result for both variant:array(0)=6array(1)="a"array(2)="b"array(3)="c"array(4)="d"array(5)="e"array(6)="f"
go to post Vitaliy Serdtsev · Jan 10, 2017 You could do the same thing by creating a View with a function in the WHERE clause that called the method to figure out if you should see the row or not.responsibility lies on developer don't to forget add additional conditions: WHERE, %IGNOREINDEX, etc.the query becomes more complicatedI think this is a cleaner solution as you do not need to worry about the %RLI becoming available again. What prevents force disable %RLI in ^%ZSTART or $SYSTEM.SQL.SetServerInitCode() ?
go to post Vitaliy Serdtsev · Jan 10, 2017 Important: pre-need string to convert to UTF-8 USER>w ##class(%xsd.hexBinary).LogicalToXSD($system.Encryption.SHAHash(512,$zcvt("тестtest","O","UTF8"))) 83B481B1A58FA416F34BFF575F2DCA866C6AB790CF0941BC0F1E7E91D916D22866CB9575C666021B2F8A796B20A484ABB29403853EDEA6173B9A61758060117E USER>w ##class(%xsd.hexBinary).LogicalToXSD($system.Encryption.SHAHash(512,$zcvt("test","O","UTF8"))) EE26B0DD4AF7E749AA1A8EE3C10AE9923F618980772E473F8819A5D4940E0DB27AC185F8A0E1D5F84F88BC887FD67B143732C304CC5FA9AD8E6F57F50028A8FF
go to post Vitaliy Serdtsev · Feb 10, 2016 In my opinion better will be so: Property SystemTime As %TimeStamp [ InitialExpression = {$ZDATETIME($NOW(),3,1,0)}, ReadOnly ]; This variant will work and for SQL and for Objects. In addition the developer will not be able to explicitly set a different value.
go to post Vitaliy Serdtsev · Jan 26, 2016 For clarity in code you can write: #include %systemInclude set varName = $$$NO ; 0 set varName = $$$YES ; 1 See ObjectScript Macros and the Macro Preprocessor