go to post Vitaliy Serdtsev · 1 hr ago Why is the correct result in the testNumbers method 321 and not 213?
go to post Vitaliy Serdtsev · Dec 15 Caché/IRIS already has ready-made macros: $$$FormatText(), $$$FormatTextHTML(), $$$FormatTextJS() , which may be useful to you and which use #def1arg.
go to post Vitaliy Serdtsev · Dec 8 Wow! By the way, if you remove the second brackets, the query works: SELECT 1 WHERE ('') = '_㉸^'It requires Java 17, and InterSystems IRIS Enterprise (it uses many connections). Do I understand correctly that with the built-in Community Edition license, the SQLancer tool cannot be fully used?
go to post Vitaliy Serdtsev · Dec 8 One of the options for Caché 2018.1: set xmlStream=##class(%Stream.FileBinary).%New() set xmlStream.Filename="C:\test_from.xml" set jsonStream=##class(%Stream.FileBinary).%New() set jsonStream.Filename="C:\test_to.json" #dim d As %Document.Object = ##class(%Document.Object).XML(xmlStream) do d.%ToJSONStream(.jsonStream) do jsonStream.%Save()
go to post Vitaliy Serdtsev · Dec 8 For i = 1:1:maxRow { Set cel = pySheet.cell(i,y) If cel."is_date" { Set val = cel.value.date().isoformat() ; ODBC Date Set MolDatum = $zdh(val,3) ; LOGICAL Date Write $zd(MolDatum),! ; DISPLAY Date } }
go to post Vitaliy Serdtsev · Dec 1 Class dc.test [ Abstract ] { ClassMethod Test() { #dim ex As %Exception.AbstractException #dim xDataStream As %Stream.Object #dim mydoc As %XML.XPATH.Document try{ set xDataStream=##class(%Dictionary.CompiledXData).IDKEYOpen(..%ClassName(1),"ClinicalDocXData").Data $$$ThrowOnError(##class(%XML.XPATH.Document).CreateFromStream(xDataStream, .mydoc,,,,,"s urn:hl7-org:v3")) $$$ThrowOnError(mydoc.EvaluateExpression("//s:entry/s:Id", "text()", .tRes)) for i =1:1:tRes.Count() { write tRes.GetAt(i).Value,! } }catch(ex) { write "Error ", ex.DisplayString(),! } } XData ClinicalDocXData { <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MainDocument xmlns="urn:hl7-org:v3"> <realmCode code="IT"/> <title>kjbkjkjbkjb</title> <effectiveTime value="20090905150716"/> <versionNumber value="1"/> <component> <body>mhvjhjkvhj</body> <component> <section>content</section> <ID>5</ID> <title>Certificato</title> <text/> <entry> <Id>5</Id> </entry> <entry> <Id>6</Id> </entry> </component> </component> </MainDocument> } }Result: USER>do ##class(dc.test).Test() 5 6
go to post Vitaliy Serdtsev · Nov 27 TEST.TEST.cls Class TEST.TEST Extends %Persistent { Property userActionone As %Boolean [ SqlColumnNumber = 2 ]; Property userActiontwo As %Boolean [ SqlColumnNumber = 3 ]; Property userActionthree As %Boolean [ SqlColumnNumber = 4 ]; Property userActionfour As %Boolean [ SqlColumnNumber = 5 ]; Property userActionfive As %Boolean [ SqlColumnNumber = 6 ]; Property userActionsix As %Boolean [ SqlColumnNumber = 7 ]; Property userActionseven As %Boolean [ SqlColumnNumber = 8 ]; Property userActioneigth As %Boolean [ SqlColumnNumber = 9 ]; Property userActionnine As %Boolean [ SqlColumnNumber = 10 ]; Property userActionten As %Boolean [ SqlColumnNumber = 11 ]; Property userActioneleven As %Boolean [ SqlColumnNumber = 12 ]; Property userActiontwelve As %Boolean [ SqlColumnNumber = 13 ]; Property userActionthirteen As %Boolean [ SqlColumnNumber = 14 ]; Property userActionfourteen As %Boolean [ SqlColumnNumber = 15 ]; ClassMethod Fill() { &sql(truncate table TEST.TEST) &sql(insert into TEST.TEST (userActionone, userActiontwo, userActionthree, userActionfour, userActionfive, userActionsix, userActionseven, userActioneigth, userActionnine, userActionten, userActioneleven, userActiontwelve, userActionthirteen, userActionfourteen) select 0,0,0,0,0,0,0,0,0,0,0,0,0,0 union all select 1,0,0,0,0,0,0,0,0,0,0,0,0,0 union all select 0,1,0,0,0,0,0,0,0,0,0,0,0,0 union all select 0,0,1,0,0,0,0,0,0,0,0,0,0,0 union all select 0,0,0,1,0,0,0,0,0,0,0,0,0,0 union all select 0,0,0,0,1,0,0,0,0,0,0,0,0,0 union all select 0,0,0,0,0,1,0,0,0,0,0,0,0,0 union all select 0,0,0,0,0,0,1,0,0,0,0,0,0,0 union all select 0,0,0,0,0,0,0,1,0,0,0,0,0,0 union all select 0,0,0,0,0,0,0,0,1,0,0,0,0,0 union all select 0,0,0,0,0,0,0,0,0,1,0,0,0,0 union all select 0,0,0,0,0,0,0,0,0,0,1,0,0,0 union all select 0,0,0,0,0,0,0,0,0,0,0,1,0,0 union all select 0,0,0,0,0,0,0,0,0,0,0,0,1,0 union all select 0,0,0,0,0,0,0,0,0,0,0,0,0,1 ) } } That's what I get: PS: Have you tried rebuilding the cube?
go to post Vitaliy Serdtsev · Nov 27 As you can see, the author asked two questions: In some cases, it's necessary to manipulate data from one namespace to another. For example, a routine in the "N1" namespace needs data from the "N2" namespace. In the same context, how could I make a persistent class global for all namespaces? The only way I know is by putting it in %SYS. What would be the best practices for these use cases? I answered the second question, and the other participants answered the first.
go to post Vitaliy Serdtsev · Nov 27 Both. Just for understanding. Will the result change if the conditions are reversed? For example: $SELECT( %source.userActionfourteen=1:"User action fourteen", %source.userActionthirteen=1:"User action thirteen", %source.userActiontwelve=1:"User action twelve", %source.userActioneleven=1:"User action eleven", %source.userActionten=1:"User action ten", %source.userActionnine=1:"User action nine", %source.userActioneigth=1:"User action eigth", %source.userActionseven=1:"User action seven", %source.userActionsix=1:"User action six", %source.userActionfive=1:"User action five", %source.userActionfour=1:"User action four", %source.userActionthree=1:"User action three", %source.userActiontwo=1:"User action two", %source.userActionone=1:"User action one", 1:"Other")
go to post Vitaliy Serdtsev · Nov 26 I agree. $CASE(1, %source.userActionone:"User action one", %source.userActiontwo:"User action two", %source.userActionthree:"User action three", %source.userActionfour:"User action four", %source.userActionfive:"User action five", %source.userActionsix:"User action six", %source.userActionseven:"User action seven", %source.userActioneigth:"User action eigth", %source.userActionnine:"User action nine", %source.userActionten:"User action ten", %source.userActioneleven:"User action eleven", %source.userActiontwelve:"User action twelve", %source.userActionthirteen:"User action thirteen", %source.userActionfourteen:"User action fourteen", :"Other")But the result will still be only one value, even if all %source.userActionXXX=1.
go to post Vitaliy Serdtsev · Nov 26 What result should $select return if the conditions %source.userActionone=1 AND %source.userActiontwo=1 are true ?
go to post Vitaliy Serdtsev · Nov 25 Distributing Library Packages: Percent (%) classes vs %ALL namespace
go to post Vitaliy Serdtsev · Nov 25 &sql(DECLARE C2 CURSOR FOR SELECT name INTO :name FROM person where name = :namevar)See Host Variables
go to post Vitaliy Serdtsev · Nov 24 Strange. I just checked on Caché Studio 2014.1.5 and Caché 2014.1.5 (logged in under superuser) - output CSTUDIO.EXE
go to post Vitaliy Serdtsev · Nov 20 s json=[ {"s":"iPhone1"}, {"s":"iPhone2"}, {"s":"IPHONE3"}, {"s":"IPHONE4"}, {"s":"Phone5"} ] d ##class(%ASQ.SetUtils).pp(json.apply("$[*]?(@.s like_regex '\p{LL}\w+')"))Output (IRIS 2025.3CE): [ { "s": "iPhone1" }, { "s": "iPhone2" } ]
go to post Vitaliy Serdtsev · Nov 20 Check the result outputs of the following code from Studio and from Terminal: w $zu(67,13,$j)
go to post Vitaliy Serdtsev · Nov 13 A long time ago, back in the days of Caché, I made a series of articles on creating a web application based on REST and CSP with my own static file processing. Try it, maybe you can use something from there.