go to post Robert Cemper · Jan 22 I understand that you want to have full control of your versionIncrement and Decrement eventually also more than just +1,-1so VERSIONPROPERTY is a dead herring.BUT: You can achieve this in combination with a little SQL method. Property RowVer As %Integer [ SqlComputeCode = { if $i({*},$g(%IncDec)) }, SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE) ]; ClassMethod IncDec(step As %Integer = 0) As %Boolean [ SqlName = IncDec, SqlProc ] { set %IncDec=step quit 1 } Now you can set the increment to any %Integer of your choice.e.g. -1 decrement by 1, 1 increment by 1, 0 leave it How to use it: INSERT OR UPDATE pck.myTable SET name='Omer' WHERE pck.IncDec(-2)=1 AND .... any other conditions .... the IncDec SQLmethod is used as a static methodit doesn't reference any row dependencySo it is executed once before any row related processing. if you omit it then row_version is not changed
go to post Robert Cemper · Jan 20 Yes i! I'm quite sure! DSTIME was introduced with or short after release of DeepSee morethan a decade back and didn't change.
go to post Robert Cemper · Jan 20 you have to add you own RowVersion property.my example only increases the version if there was a any change in the row. Property RowVer As %Integer [ SqlComputeCode = { if $i({*}) }, SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE) ]; works for SQL- and Object-mode
go to post Robert Cemper · Jan 17 Almost 6 years back I wrote and article on data synchronizationUsing DSTIME and a related example in OEX.It is focussed on detecting and optimizing insert, change, delete of specified Tables/Classesand it takes care of processing cycles to avoid duplications.So the output might be minimized.Transmission speed to PostgreSQL is not part of the example
go to post Robert Cemper · Jan 14 like this: /// using $ZZFIX() custom function Class rcc.GetFixZZ Extends %Library.String { Parameter LENGTH As %String = 10; Parameter ALIGN As %String = "LEFT"; Parameter PADCHAR As %String = " "; Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_"""" set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit $ZZFIX(%val,"_code ) QUIT $$$OK } ClassMethod StorageToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_"""" set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit $ZZFIX(%val,"_code ) QUIT $$$OK } }
go to post Robert Cemper · Jan 14 Though, if you need this functionality over multiple namespacesI'd suggest to use a Language Extension:#1 an .inc for the the code definition in namespace %SYS ROUTINE ZZFIX [Type=INC] /// fix length string + padding + l/r-adjustment ZZFIX(%val, len , pad = "", right = 0) if right quit $e($tr($j("",len)," ",$e(pad_" "))_%val,*+1-len,*) quit $e(%val_$tr($j("",len)," ",$E(pad_" ")),1,len) #2 add this line to %ZLANGF00.mac #include ZZFIX after compiling it you may run a test in any namespace USER>set test="213abc" USER>write $ZZFIX(test,10,"*") 213abc**** USER>write $ZZFIX(test,10,"*",1) ****213abc USER>write $zzfix(test,5,"*",1) 13abc USER>write $zzfix(test,15,"$") 213abc$$$$$$$$$ USER>write $zzfix(test,15,"$",1) $$$$$$$$$213abc USER> If available this could of course also replace theClassMethod in the DataType definition.It's a matter of taste.
go to post Robert Cemper · Jan 13 Thank you @Jeffrey Drumm !Yet another idea:Sometimes you may want a static non-blank padding character.e.g. ****123 or 345~~~~this is included as Parameter PADCHAR as %String =" " ; default= blank /// padding other than " " might be useful in some cases Class rcc.GetFixSqlPad Extends %Library.String { Parameter LENGTH As %String = 10; Parameter ALIGN As %String = "LEFT"; Parameter PADCHAR As %String = ""; Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_"""" set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSqlPad).Fix(%val,"_code ) QUIT $$$OK } ClassMethod StorageToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","""_$E(%parameter("PADCHAR")_" ",1)_"""" set code=code_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSqlPad).Fix(%val,"_code ) QUIT $$$OK } /// PADCHAR=" "; LEFT=0, RIGHT=1 ClassMethod Fix(%val, rcc, rccp = "", rccal = 0) As %String { if rccal{ set %val=$e($tr($j("",rcc)," ",$e(rccp_" "))_%val,*+1-rcc,*) } else { set %val=$e(%val_$tr($j("",rcc)," ",$e(rccp_" ")),1,rcc) } quit %val } }
go to post Robert Cemper · Jan 12 This doesn't work for SQL - Therefore a new version Class rcc.GetFixSql Extends %Library.String { Parameter LENGTH As %String = 10; Parameter ALIGN As %String = "LEFT"; Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSql).Fix(%val,"_code ) QUIT $$$OK } ClassMethod LogicalToDisplay(%val As %String) As %String [ CodeMode = generator, ServerOnly = 0 ] { set code=+%parameter("LENGTH")_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSql).Fix(%val,"_code ) QUIT $$$OK } ClassMethod LogicalToOdbc(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSql).Fix(%val,"_code ) QUIT $$$OK } // only required for SQL Display Logical mode ! ClassMethod StorageToLogical(%val As %String) As %String [ CodeMode = generator, ServerOnly = 1 ] { set code=+%parameter("LENGTH")_","_("RIGHT"=$zcvt(%parameter("ALIGN"),"U"))_")" $$$GENERATE(" quit ##class(rcc.GetFixSql).Fix(%val,"_code ) QUIT $$$OK } /// LEFT=0, RIGHT=1 ClassMethod Fix(%val, rcc, rccal = 0) As %String { if rccal{ set %val=$e($j(%val,rcc),*+1-rcc,*) } else { set %val=$e(%val_$j("",rcc),1,rcc) } quit %val } }
go to post Robert Cemper · Jan 12 A more compact data type with LENGTH and ALIGNFor RIGHT alignment I cut off oversized data by LENGHT counted from the end. Class rcc.GetFixAligned Extends %Library.String { Parameter LENGTH As %String = 10; Parameter ALIGN As %String = "LEFT"; Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set rcc=+%parameter("LENGTH") if "RIGHT"=$zcvt(%parameter("ALIGN"),"U") { set code="$e($j(%val,"_rcc_"),*+1-"_rcc_",*)" } else { set code="$e(%val_$j("""","_rcc_"),1,"_rcc_")" } $$$GENERATE(" Quit "_code) QUIT $$$OK } }
go to post Robert Cemper · Jan 11 by extending %RegisteredObject you lost the basic data typeand all other parameters of %Stringthis should do it: Class rcc.FixStr Extends (%Library.String, rcc.FixStr.Props) { /// Fill value according to LENGTH parameter Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set tCode="$e(%val_"""_$j("",+%parameter("LENGTH")) set tCode=tCode_""",1,"_+%parameter("LENGTH")_")" $$$GENERATE( " Quit "_tCode) QUIT $$$OK } }
go to post Robert Cemper · Jan 2 different approach: SELECT LI.id from FDRD_Com.List LI JOIN FDRD_Com.Prod PR ON LI.vehicle = PR.Car WHERE PE.ProductLineName='Toyota' AND PR.Car is not null -- might be obsolete
go to post Robert Cemper · Nov 21, 2024 Hi @Jeffrey Drumm ;different approach: use your own datatype that always returns fixed MAXLEN string: /// Make fixlength String according to MAXLEN parameter Class rcc.GetFix Extends %Library.String { /// Fill value <var>%val</var> to <a href="#MAXLEN">MAXLEN</a> characters. Method Get() As %String [ CodeMode = generator, ServerOnly = 1 ] { set code="$e(%val_"""_$j("",+%parameter("MAXLEN")) set code=code_""",1,"_+%parameter("MAXLEN")_")" $$$GENERATE( " Quit "_code) QUIT $$$OK } } and a test class: Class rcc.FixTest Extends %RegisteredObject { Property test As rcc.GetFix(MAXLEN = 12); } and now some check from terminal: SAMPLES>set z=##class(rcc.FixTest).%New() set z.test="rob" SAMPLES>write z.test,$L(z.test) rob 12 SAMPLES>;some oversized string SAMPLES>set z.test=";some oversized string" SAMPLES>write z.test,$L(z.test) ;some oversi12 SAMPLES> Hope this helps you along
go to post Robert Cemper · Nov 11, 2024 #2)Every LOCK persists until the process is ended or the LOCK is removed explicitely (LOCK -....)it is not related to any error handling. #1)depends on your design.If there is no conflict of subscripts between ADD and REMOVE possible there is no need of a Lock
go to post Robert Cemper · Oct 22, 2024 So you have a local instance of Caché as well. Check with WRC if Cachè 13 is supported on Windows 11. local access needs no firewall in Win
go to post Robert Cemper · Oct 20, 2024 the example builds on the fact that the storage structure of the serial object is known Storage Default { <Data name="serItemState"> <Value name="1"> <Value>Subject</Value> </Value> <Value name="2"> <Value>Change</Value> </Value> <Value name="3"> <Value>Color</Value> </Value> </Data> <State>serItemState</State> <StreamLocation>^rcc.IC.serItemS</StreamLocation> in this case color is #3 in serial storage ==>> $list(%Value,3) So you need to know the position of FamilyName in HS.SDA3.Name (e.g.7 ?)then you can use $list(%value,7) = 'Twain' as condition 7 is just a guess as I don't have any HS* classes at hands
go to post Robert Cemper · Sep 13, 2024 if $d(^|"%SYS"|CONFIG("Namespaces"," ")) for set ns=$o(@$ZR) quit:ns="" write ns,! ; or do whatever you intend
go to post Robert Cemper · Sep 11, 2024 ÍD is an reserved name in IRIS / Ensemblein fact as you describe it, it is rather a KEY than a typical IDso this query may serve your needs SELECT LIST(Value) WHERE KEY=11 SELECT LIST(Value) WHERE KEY=12
go to post Robert Cemper · Aug 18, 2024 with set pSettings("From_Source_Rec_Job","Adapter... you pass a String literal assuming the value of your variable str = From_Source_Rec_Job then set pSettings(str,"Adapter","FTPPort")=2022 should be sufficient