go to post Vitaliy Serdtsev · Mar 13, 2024 size = 207 195 179 ClassMethod Type(a...) As %String { f j=$i(r):1:a{s w=$tr(a(j)," "),p=$f(w,",")-2 f i=2:1:$l(w,",") s c=$l($p(w,",",i)),r=$s(p=c:r,r+p-c<2:2,c<p*2#r:3,1:4),p=c} q $p("Constant7Increasing7Decreasing7Unsorted",7,r) }
go to post Vitaliy Serdtsev · Mar 1, 2024 Try this: ClassMethod test2() { set tKP = ..%New() set tIdentifierSerial = ##class(HS.Message.AddUpdateHubRequest).%OpenId(21986071).Identifiers zw tIdentifierSerial set tKP.IsSerial = 1 set tKP.IsList = 1 set tSerial = tIdentifierSerial.GetObjectNext(.tKey) for { if tKey="" {quit} do tKP.SerialList.InsertObject(tSerial) set tSerial = tIdentifierSerial.GetObjectNext(.tKey) } w tKP.%Save() }
go to post Vitaliy Serdtsev · Feb 20, 2024 As far as I understand, the author wants to calculate the value of a field based on some list of fields whose names he takes from some table. Right?
go to post Vitaliy Serdtsev · Feb 20, 2024 Try inserting an apostrophe through concatenation, something like INSERT INTO MyText (text) VALUES ('I visited O' || CHAR(39) || 'Brien before heading out of town.')
go to post Vitaliy Serdtsev · Feb 8, 2024 I'm getting an error: ERROR #9406: Unexpected format for value of field, searchCriteria, using class base mappingAfter fixing the JSON, the error disappeared: {"searchCriteria": {..}} ==> {"searchCriteria": [{..}]}Also note the mapping between the fields professionalId/professionalNif and preparation/actPreparation
go to post Vitaliy Serdtsev · Feb 8, 2024 Your code does not take into account the numbers, so an incorrect result is given for "L33T C0d3r".
go to post Vitaliy Serdtsev · Feb 7, 2024 SELECT JSON_ARRAYAGG(json_obj) FROM (SELECT TOP 5 JSON_OBJECT( 'Name':name ,'Age':age ,'DOB':to_char(dob,'Day DD Month YYYY') ) json_obj FROM sample.person )SELECT JSON_ARRAYAGG(json_obj) FROM (SELECT JSON_OBJECT( 'Name':name ,'Age':age ,'DOB':to_char(dob,'Day DD Month YYYY') ) json_obj FROM sample.person ) WHERE %VID BETWEEN 1 AND 5
go to post Vitaliy Serdtsev · Jan 30, 2024 Reduced your code to 127: ClassMethod ToKeyPad(p) As %String { a s l=$f(" 0 1 ABC2 DEF3 GHI4 JKL5 MNO6 PQRS7TUV8 WXYZ9",$$$UPPER($e(p,$i(i)))) q:l=1 r s:l $p(r,l-2\5,*+l-2#5+1)="" g a }
go to post Vitaliy Serdtsev · Jan 29, 2024 Reduced your code to 137: ClassMethod ToKeyPad(p) As %String { f i=1:1:$l(p){f j=0:1:9{f l=1:1:$f($p(" 0^1^ABC2^DEF3^GHI4^JKL5^MNO6^PQRS7^TUV8^WXYZ9","^",j+1),$e($$$UPPER(p),i))-1 s r=$g(r)_j}} q r }
go to post Vitaliy Serdtsev · Dec 20, 2023 Yes, most likely this is legacy code. For some reason I thought that since the %JSON package classes appeared only in IRIS, the code would also have to be new. PS: by the way, can you compile an XData block without a name? Studio doesn't highlight the error?
go to post Vitaliy Serdtsev · Dec 19, 2023 It is strange that the bug has not been fixed yet, because it is easy to fix it by adding one line to ##class(%JSON.Generator).GenerateMappingFromXdata(): <..> For i=1:1:count { Set xdata=compiledclass.XDatas.GetAt(i) Set configName=xdata.Name If configName="" Continue ; since the Name field is required, how can it be empty? If xdata.MimeType'="text/xml" Continue <..>PS: by the way, I didn't quite understand why need to check "configName", given that "Name" is a required field. Any ideas?
go to post Vitaliy Serdtsev · Nov 15, 2023 For versions of Caché 5.0.x, try the following code: #include %systemInclude n s list=$lb( "test", "for", "searching unknown strings here is a very long piece with enough characters to get a lowercase alpha as a $list marker", "items", "in", "aaatArGetwaaaa", "lists", $lb( "/subs", "/values", "nested list", "did you see that ""w"" before the third piece?", "Stuart Strickland", "Yaron Munz") ) s str=$$$UPPER($$cccvt^%Wpglo(list,$$$MaxStringLength,.warn)) ; or ; s str=$$$UPPER($$listDump^%Wprim(list,9)) i 'warn { s str=$e(str,3,$l(str)-2) ; remove << & >> ;s @("LIST="_str) zw LIST w !,$f(str,$$$UPPER("Targetw")) }Result: 162 If you end up searching for globals that use $lb(), then you might find it useful: $$gloFind^%Wprog(gref,string,case,.record) - for Caché 5.0.x ##class(%Global).Find/Get() - for new versions of Caché/IRIS
go to post Vitaliy Serdtsev · Nov 10, 2023 You can convert a list to a string (and vice versa), regardless of the number of nestings. Unfortunately, I can't test this code for Caché 5.x, but I think it should work. Here is a small example of searching for a string in a list: #include %systemInclude n s list=$lb( "test", "for", "searching unknown strings here is a very long piece with enough characters to get a lowercase alpha as a $list marker", "items", "in", "aaatArGetwaaaa", "lists", $lb( "/subs", "/values", "nested list", "did you see that ""w"" before the third piece?", "Stuart Strickland", "Yaron Munz") ) s str=$$$UPPER(##class(%Utility).FormatString(list,,.overflow)) i 'overflow { ;s @("LIST="_str) zw LIST w !,$f(str,$$$UPPER("Targetw")) }Result: 162
go to post Vitaliy Serdtsev · Aug 25, 2023 There are much more interesting examples in the documentation, for example: w -"2Cats"_"Rats" w "8 apples" - "4 oranges" w "8 apples" - "four oranges"
go to post Vitaliy Serdtsev · Aug 25, 2023 To your data storage scheme, I would like to clarify one point. Let's say there is the following data: Organization ID 1 2 3 GetOrgUpdatesResponse ID Organizations 1 2,3 2 1,2 3 1,3 If you delete ID=1 (GetOrgUpdatesResponse), then ID=2 and ID=3 (Organization) will be automatically deleted. But in this case, the rows ID=2 and ID=3 (GetOrgUpdatesResponse) will contain incorrect data and the referential integrity will be violated. Or am I wrong?
go to post Vitaliy Serdtsev · Aug 24, 2023 Alternatively, you can create a custom task that runs every 15 minutes, in which to enable disabled users. Since there are other ways to connect besides CSP, this will be more universal. PS: why not disable "Disable account if login limit reached" and reduce Invalid login limit?
go to post Vitaliy Serdtsev · Aug 24, 2023 What about method %SYS.Audit.Erase(Flags As %Integer = 0)? Erase the audit file. Flags: 0 - Erase all contents 1 - Erase and create new audit file 2 - Erase and create new audit file, treat as encryption state changed Note that bit 1 infers that ALL data in the audit database will be deleted, not just Audit data