Article Benjamin Thorne · Jul 24, 2018 1m read

The following code allows a user to view the audit settings of their instance. Run the code by running the class method "test":


class objectscript.checkAudit Extends %RegisteredObject
{
classmethod test() {
w "Checking for Auditing.",!
Set SYSOBJ = ##class(Security.System).%OpenId("SYSTEM")
If +SYSOBJ = 0 Set SYSOBJ = ##class(Security.System).%New()
i SYSOBJ.AuditEnabled {
w "Security Auditing is enabled for the following services",!
s rs=##class(%ResultSet).%New("Security.Events:ListAllSystem")
s sc=rs.Execute()  If $$$ISERR(sc) Do DisplayError^%apiOBJ(sc) Quit
while rs.
1
1 778
Article Benjamin Thorne · Jul 17, 2018 1m read

The following code snippet uses GZIP to compress/decompress a file. Choose a file by specifying a file path in the "filename" variable.


Class objectscript.GZIP Extends %RegisteredObject
{
classmethod test() {
//Export Global(s) uncompressed
set filename="C:\Temp\myglobal.xml"
do $System.OBJ.Export("^oddEXTR.gbl",filename)
//Open exported Globals
set uncompressed = ##class(%FileBinaryStream).%New()
set uncompressed.Filename=filename
Set compressed = "C:\temp\mycomglobal.
6
1 2414