go to post Vitaliy Serdtsev · Nov 23, 2021 There is a ready-made method for this: getFileslink Usage example: s path="C:\Temp" s pExtension=1 s pExtension(1)="*" s pTempNode=$i(^CacheTemp) k ^CacheTemp(pTempNode) d ##class(%SQL.Util.Import).getFiles(path,.pExtension,pTempNode,1) m dirlist=^CacheTemp(pTempNode) k ^CacheTemp(pTempNode) zw dirlist
go to post Vitaliy Serdtsev · Nov 19, 2021 It's okay, I already have a minus. It looks like this is my last comment here. UPD: w $$Iso8601ToTimeStamp("2021-10-22T08:00:00+0900"),! w $$Iso8601ToTimeStamp("2021-11-04T11:10:00+0100"),! w $$Iso8601ToTimeStamp("2021-11-04T11:10:00+0200"),! w $$Iso8601ToTimeStamp("2021-11-04T11:10:00-0140"),! Iso8601ToTimeStamp(ts) { s r=##class(%TimeStamp).XSDToLogical($e(ts,1,22)_":"_$e(ts,*-1,*)) w r," => " q $zdth(r,3) }Output: USER>do ^test 2021-10-21 23:00:00 => 66038,82800 2021-11-04 10:10:00 => 66052,36600 2021-11-04 09:10:00 => 66052,33000 2021-11-04 12:50:00 => 66052,46200
go to post Vitaliy Serdtsev · Nov 4, 2021 I know, that's why I gave a link to the documentation so that the author would do the rest of the work himself, since ISO 8601 has many forms. Here is another variant of the ISO8601ToDateTime method.
go to post Vitaliy Serdtsev · Nov 4, 2021 $zdth() USER>w $zdth("2021-11-04T11:10:00+0100",3,5) 66052,40200
go to post Vitaliy Serdtsev · Nov 3, 2021 In this case, you can do this: SELECT %TSQL.ZRAND(%ID+1e16) rnd, ID, Citizenship, DOB, FirstName, Gender, IDNumber, LastName, PatientNumber, PhoneNumber FROM CDR.PatientType of rnd - DOUBLE. Of course, you can convert it to NUMERIC or STRING
go to post Vitaliy Serdtsev · Nov 3, 2021 For debugging purposes and further query optimization, why not? I have a legacy code that I need to optimize.
go to post Vitaliy Serdtsev · Nov 3, 2021 Try calling the ClearBuffers in the GLOBUFF system routine, e.g.: USER>d ClearBuffers^|"%SYS"|GLOBUFF() Removed 65303 blocks
go to post Vitaliy Serdtsev · Nov 3, 2021 Try Built-in Modal Groups E.g.: Class dc.test Extends %ZEN.Component.page { XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { <page xmlns="http://www.intersystems.com/zen"> <tablePane id="tp" sql="select 1 id, '2021-11-03' DT union select 2, '2022-01-24'"> <column colName="id"/> <column colName="DT" link="javascript:zenPage.modalGroupCalendar('#(%query.DT)#');"/> </tablePane> </page> } ClientMethod modalGroupCalendar(val) [ Language = javascript ] { var group = zenPage.createComponent('modalGroup'); group.setProperty('onaction','zenPage.calendarAction(group);'); group.show('Select a date:','calendar',val); } ClientMethod calendarAction(group) [ Language = javascript ] { alert("You selected: " + group.getValue()); // SaveOnServer(); ! } }
go to post Vitaliy Serdtsev · Nov 3, 2021 Try this: Class dc.test Extends %ZEN.Component.page { XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ] { <page xmlns="http://www.intersystems.com/zen"> <tablePane id="tp" sql="select 1 id, 'a' FollowUp union select 2,'b'"> <column colName="id"/> <column colName="FollowUp" header="FollowUp Comments" width="9%" style="text-align:left;" OnDrawCell="txtFollowUp"/> </tablePane> </page> } Method txtFollowUp( pTable As %ZEN.Component.tablePane, pName As %String, pSeed As %String) As %Status { &html<<textarea name="followup" rows="3" style=" width: 95%;" onchange="zenPage.saveFollowUp(this.value,#(%query("id"))#);">#(%query(pName))#</textarea>> Quit $$$OK } ClientMethod saveFollowUp( val, id) [ Language = javascript ] { zenAlert(val,' <-> ',id); } }
go to post Vitaliy Serdtsev · Nov 3, 2021 This functionality is available when working with ActiveX (however, ActiveX is not recommended for use in new applications): Using Callback Functionality SetOutput() PS: in the Caché distribution there was even a special library DelphiCallback.dll for Delphi, an example of working with which is in my blog.
go to post Vitaliy Serdtsev · Nov 2, 2021 I did a small test locally (for Caché). test.py: print("success") exit()From terminal: USER>w $zf(-1,"python C:\tmp\test.py") 0From Studio Output Window: w $zf(-1,"python C:\tmp\test.py") 0Make sure that your service for Caché/IRIS use an account with administrative rights: Windows User Accounts Changing the InterSystems Service Account
go to post Vitaliy Serdtsev · Nov 2, 2021 It should be like this (see Work with multiple sql statements): DELETE FROM TableName WHERE ID = 2 GO DELETE FROM TableName WHERE ID = 3 GO DELETE FROM TableName WHERE ID = 4 GO
go to post Vitaliy Serdtsev · Oct 27, 2021 In this case you can open the original article and take the code from there (and/or translate it with another service, for example Google translate)
go to post Vitaliy Serdtsev · Oct 26, 2021 See my old article on my blog: Examples of generating and sending Email using the Caché DBMS (this is machine translation)
go to post Vitaliy Serdtsev · Oct 15, 2021 ClassMethod testvalidator( class As %String, value As %String) As %Status { set validator = "(out){set out = ##class("_class_").IsValid("""_value_""")}" xecute (validator,.sc) write sc,! quit sc }
go to post Vitaliy Serdtsev · Oct 15, 2021 Use $CLASSMETHOD and you won't have such issues: USER>set sc=$CLASSMETHOD("%Numeric","IsValid","BLAH") or ClassMethod testvalidator(class As %String, value As %String) As %Status { set sc=$CLASSMETHOD(class,"IsValid",value) write sc,! quit sc }
go to post Vitaliy Serdtsev · Oct 15, 2021 Set object = ##class(%ZEN.proxyObject).%New() set object.city = "New York" set object.Target = "TEST" set object.Details = "TEST" set object.RefCode = "123" set object.Reason = "123TTTT" set string=object.%Serialize() ;write string,! set anotherObj=##class(%ZEN.proxyObject).%New() do anotherObj.%ZENDeserialize(string) write anotherObj.Reason ; ==> 123TTTT
go to post Vitaliy Serdtsev · Oct 11, 2021 codemode = code: ClassMethod AddWater( s, t = {$lb("",1,22,333,4444,55555,666666,7777777,88888888,999999999)}, r = "") As %String { f i=1:1:$l(s) s r=r_$li(t,$e(s,i)+1) q r }codemode = expression: ClassMethod AddWater( s, r = {"" s r="" f i=1:1:$l(s) s t=$e(s,i) s:t r=r_$tr($j(t,t)," ",t)}) As %String [ CodeMode = expression ] { r }Required mapping ISCDC.inc from CACHESYS: Include ISCDC Class dc.test [ Abstract ] { ClassMethod AddWater(s) As %String { f i=$l(s):-1:1 s t=$e(s,i),$e(s,i)=$$DC(t,t) q s } }