go to post Vitaliy Serdtsev · Dec 7, 2021 Try the following: enable "Retain cached query source" as described above compile your class/project with addition flags "k /compileembedded=1" (see Validating Embedded SQL Code) open the code of the generated program from the Studio or System Portal like %sqlcq.[YOURNAMESPACE].xETs3uMe2Ehn2LY5inuZiK4xgwnS.1.int Note: at the same time, do not forget to specify checkbox for system items Profit!
go to post Vitaliy Serdtsev · Dec 3, 2021 See this. Note: For Caché, there will be a "\Intersystems\Cache\" instead of "\Intersystems\IRIS\". Also note that for the 32-bit version, the paths in the registry will be slightly different from those specified in the example.
go to post Vitaliy Serdtsev · Dec 3, 2021 stop IRIS close IRIS Launcher (aka Cube) open regedit (run as Administrator) rename instance name (let's say "ABC") [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\IRIS\Configurations\ABC] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\IRIS\Configurations\ABC\Manager\PreferredServer] @="ABC" run IRIS Launcher (aka Cube) and rename server names. If you want, you can also do this through the registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\CACHE\Servers\ABC] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Intersystems\CACHE\Servers] "DefaultServer"="ABC" start IRIS Profit! Now the instance name is ABC.
go to post Vitaliy Serdtsev · Nov 24, 2021 In this case, you should wait for IRIS 2021.2 with built-in Python and use Jinja directly. In the meantime, there is the following: Developing Custom Tags Making Your Own Studio Templates
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 $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 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 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 7, 2021 For more details, see the documentation on Caché, for example: Namespace tab of the Studio Workspace window (and not Project tab) And more (see screenshot)
go to post Vitaliy Serdtsev · Oct 6, 2021 Those experienced with encryption systems for databases may have concerns about encryption having dire effects on performance, but, with Caché, these concerns are unfounded. Encryption and decryption have been optimized, and their effects are both deterministic and small for any Caché platform; in fact, there is no added time at all for writing to the database. Managed Key Encryption: Protecting Data on Disk InterSystems recommends using its encryption management tools: When built-in hardware instructions are available for encryption-related activities, these activities are considerably faster then when using software-based encryption. The encryption management tools use hardware instructions when they are available. The encryption management tools can use keys stored on a KMIP server. The encryption management tools can run in FIPS mode. About Encryption Management Operations High-Performance Encryption for Databases in Financial Services (PDF)
go to post Vitaliy Serdtsev · Sep 29, 2021 COS: Class dc.DPasarela Extends %RegisteredObject { Property STREAM As %Stream.TmpBinary; Method PostMsg() { s s=$tr($j("",$$$MaxStringLength)," ",$c(0)) f i=1:1:5 d ..STREAM.Write(s) } }C# IRISObject STREAM; MemoryStream stream = new MemoryStream(); string len1, len2; IRISObject pasarela = (IRISObject)iris.ClassMethodObject("dc.DPasarela", "%New"); pasarela.InvokeVoid("PostMsg"); STREAM = (IRISObject) pasarela.Get("STREAM"); while (!Convert.ToBoolean(STREAM.GetBool("AtEnd"))) { stream.Write(STREAM.InvokeBytes("Read", 3641144),0, 3641144); } len1 = STREAM.GetString("Size"); // 18205720 (3641144*5) len2 = stream.Length.ToString(); // 18205720 (3641144*5) // =========== AGAIN =========== STREAM.InvokeVoid("MoveToEnd"); pasarela.InvokeVoid("PostMsg"); stream.SetLength(0); while (!Convert.ToBoolean(STREAM.GetBool("AtEnd"))) { stream.Write(STREAM.InvokeBytes("Read", 3641144), 0, 3641144); } len1 = STREAM.GetString("Size"); // 36411440 (18205720*2) len2 = stream.Length.ToString(); // 36411440 (18205720*2) byte[] bytesS = stream.ToArray();
go to post Vitaliy Serdtsev · Sep 23, 2021 See %SQL.StatementResult:%DisplayFormatted() Simple sample (for namespace "SAMPLES"): set st = ##class(%SQL.Statement).%New(2,"Sample") set sql = 3 set sql(1) = "select TOP 5 %ID as id, Name, DOB, Home_State" set sql(2) = "from Person where Age > 40" set sql(3) = "order by 2" do st.%Prepare(.sql) for type="txt","pdf","csv","html","xml" { set rs = st.%Execute() do rs.%DisplayFormatted(type,"C:\Temp\report") }As a result, the following files are generated: report.csv report.html report.pdf report.txt report.xml
go to post Vitaliy Serdtsev · Sep 17, 2021 An example without complex formulas and very fast Include %DeepSee Class dc.test [ Abstract ] { ClassMethod FirstLastDayMonth( year = 2015, month = 2) { s mm=$$$iscPadZero(month,2), firstDay=$zdh(year_mm_"01",8), lastDay=$zdh(year_mm_$$$iscDaysInMonth(year,month),8), firstDayName=$zd(firstDay,12,,,,,,,,1), lastDayName=$zd(lastDay,12,,,,,,,,1) w $$$FormatText("firstDay = %1 (%2), lastDay = %3 (%4)",$zd(firstDay),firstDayName,$zd(lastDay),lastDayName),! } /// d ##class(dc.test).Test() ClassMethod Test() { d ..FirstLastDayMonth(2015,2), ..FirstLastDayMonth(2021,9) } } USER>d ##class(dc.test).Test() firstDay = 01.02.2015 (Sunday), lastDay = 28.02.2015 (Saturday) firstDay = 01.09.2021 (Wednesday), lastDay = 30.09.2021 (Thursday)