#Tips & Tricks

0 Followers · 317 Posts

Pieces of experience in InterSystems Technology which solve some particular problem in elegant or unusual way.

Announcement Raj Singh · Feb 14, 2023

For those of you who still use the Studio IDE for ObjectScript programming and are going through the process of migrating to VS Code, did you know there's a section in the VS Code documentation just for you? Have a look at the Migrating from Studio chapter. It covers:

  • Server-side editing and source control
  • Studio projects
  • Importing server definitions from the Windows Registry
  • Loading Studio snippets and syntax colors
4
0 443
Article Megumi Kakechi · Aug 15, 2024 3m read

InterSystems FAQ rubric

Temporary globals stored in the IRISTEMP/CACHETEMP databases are used when a process does not need to store data indefinitely, but requires the powerful performance of globals. The IRISTEMP/CACHETEMP databases are not journaled, so using temporary globals does not create journal files.

The system uses the IRISTEMP/CACHETEMP databases for temporary storage and are available to users for the same.

For more information about temporary globals and the IRISTEMP database, see the following document:
Temporary Globals and the IRISTEMP Database

The globals used as temporary are:

0
0 0
Article Tomoko Furuzono · Aug 8, 2024 2m read

InterSystems FAQ rubric

If you do not specify the option to remove the mirror attribute of the mirror database when deleting the mirror configuration, the database cannot be restored to a normal state and will be mounted read-only the next time it is mounted. To restore the database to a read-write state, you must remove the mirror attribute using the system routine ^MIRROR.

The procedure is as follows (execute in the %SYS namespace):

0
0 0
Article Zeljko Sucic · Jul 26, 2024 7m read

As a part of the IRIS Python 2024 contest, my colleague Damir and I went with an idea to build a platform called ShelterShare for connecting victims and volunteers for shelter requests . To do so we chose django as a framework and proceeded to build the first version with 3 different docker containers, django, iris and nginx which would then utilize IRIS as a pure Database engine via the beautifly composed django_iris (cudos to Dimitry). As we were progressing fast, we decided to explore the option of running it within the same container as IRIS by utilizing WSGI added in 2024.1. We knew ahead

0
0 0
Article Tomoko Furuzono · Jul 25, 2024 1m read

InterSystems FAQ rubric

To compile class routines including the mapped modifier, specify the compiler modifier "/mapped=1" or "/mapped". For example, do the following:

[Example 1] Get the class list and compile 

do$System.OBJ.GetClassList(.list,"/mapped")
 // build your classes starting from .listdo$System.OBJ.Compile(.list) 

[Example 2] Compile all classes 

do$system.OBJ.CompileAll("/mapped") 
0
0 0
Article Tomoko Furuzono · Jul 4, 2024 1m read

InterSystems FAQ rubric

$ZTIMESTAMP returns the date and time in UTC format, so to change it to the local time zone, use the following system method: 

$SYSTEM.Util.UTCtoLocalWithZTIMEZONE($ZTIMESTAMP)

The above output will be in the format ddddd,sssss.fff.

    ddddd: Same format as $HOROLOG dates
 sssss: An integer indicating the number of seconds elapsed since midnight on the current date
 fff: Variable number of digits indicating the fractional part of a second

* Similar to $HOROLOG, except that $HOROLOG does not include fractional seconds. 

0
0 0
Article Hiroshi Sato · Jun 27, 2024 1m read

InterSystems FAQ rubric

You can use the List query of the %SYS.Audit to output audit logs programmatically.

The sample code is as follows:

Set statement=##class(%SQL.Statement).%New()  
 Set status=statement.%PrepareClassQuery("%SYS.Audit","List")
 Set rs=statement.%Execute()  
 Set tab = $char(9)
 While rs.%Next() {    
   Write rs.%Get("TimeStamp")_tab_rs.%Get("Event")_tab_rs.%Get("Username"),!      
 }
0
0 0
Article Hiroshi Sato · Jun 6, 2024 1m read

InterSystems FAQ rubric

If you want to run an OS executable file, command, or a program created within an InterSystems product when the InterSystems product starts, write the processing in the SYSTEM^%ZSTART routine. (The %ZSTART routine is created in the %SYS namespace).

Before you write any code in SYSTEM^%ZSTART, make sure that it works properly under all conditions.

If the ^%ZSTART routine is written incorrectly, or if it is written correctly but the command does not return a response or an error occurs during processing, InterSystems products may not be able to start.

0
0 2
Article Hiroshi Sato · May 30, 2024 1m read

InterSystems FAQ rubric

To disable the timeout, set the query timeout to disabled in the DSN settings:

Windows Control Panel > Administrative Tools > Data Sources (ODBC) > System DSN configuration

If you check Disable query timeout, the timeout will be disabled.

If you want to change it on the application side, you can set it at the ODBC API level.

Set the SQL_ATTR_QUERY_TIMEOUT attribute when calling the ODBC SQLSetStmtAttr function before connecting to the data source.

0
0 262
Article Megumi Kakechi · May 23, 2024 2m read

InterSystems FAQ rubric

The TIMESTAMP type corresponds to the %Library.TimeStamp data type (=%TimeStamp) in InterSystems products, and the format is YYYY-MM-DD HH:MM:SS.nnnnnnnnn.

If you want to change the precision after the decimal point, set it using the following method.

1) Set system-wide

Management Portal: [System Administration] > [Configuration] > [SQL and Object Settings] > [General SQL Settings] 
Default time precision for GETDATE(), CURRENT_TIME, CURRENT_TIMESTAMP. You can specify the number of digits in the range 0 to 9.

0
0 278
Question Feng Wang · Apr 24, 2024

hi there,

I recently created a shell script to run the integrity check.

I used this as reference - Introduction | InterSystems IRIS Data Platform 2023.3

I found the example from above url having a line - "

kill ^IRIS.TempIntegrityOutput(+$job)

it isn't working when I used in a script. it returns the pid of my iris session instead.

I had to simplify the example to run following lines instead - 

Do CheckList^Integrity(,,,,5)
do Display^Integrity(,1,)
 

script runs fine and can see integrity check results as expected.

0
0 216
Article David Hockenbroch · Apr 25, 2024 3m read

I came up with a challenge for myself to come up with a way to make a variable watch itself for a certain value and do something when it hits that value without having to check it every time something touches it. Basically, a way to say "if at any point during the execution of this code, if x = 0 (or whatever the condition is) do this thing." The class I ended up with watches a %Status:

0
0 287
Article Hiroshi Sato · Apr 25, 2024 1m read

InterSystems FAQ rubric

For naming conventions, please check the respective document pages below.

About table name (class name): Identifier rules and guidelines - classes

About column names (property names): Identifier rules and guidelines - class members

As stated here, only alphanumeric characters and characters with Unicode code points larger than ASCII 128 can be used in column names (property names).

0
0 232
Article Megumi Kakechi · Apr 18, 2024 1m read

InterSystems FAQ rubric

When you run a routine in the terminal and an error occurs in the program, if you have not set the error trap properly, the program will enter debug mode as shown below.

USER>do^error1
 write A
^
a+2^error1 *A
USER 2d0>

From this state, enter the Quit command to return to the state before the routine was started.

USER 2d0>Quit

If a transaction is being processed within the routine where the error occurred, a prompt similar to the one below will appear.

USER>do^error1
 write A
^
a+3^error1 *A
TL1:USER 2d0>q
TL1:USER>
0
0 199
Article Evgeny Shvarov · Aug 9, 2021 1m read

Hi developers!

Just want to share an old but always relevant best practice on namespaces changing @Dmitry Maslennikov shared with me (again).

Consider method:

classmethod DoSomethingInSYS() as %Status

{

set sc=$$$OK

set ns=$namespace

zn "%SYS"

// try-catch in case there will be an error

try {

// do something, e.g. config change

}

catch {}

 zn ns    ; returning back to the namespace we came in the routine

return sc

}

And with new $namespace the method could be rewritten as:

4
0 739
Article Seisuke Nakahashi · Jan 10, 2024 5m read

[Background]

InterSystems IRIS family has a nice utility ^SystemPerformance (as known as ^pButtons in Caché and Ensemble) which outputs the database performance information into a readable HTML file. When you run ^SystemPerformance on IRIS for Windows, a HTML file is created where both our own performance log mgstat and Windows performance log are included.

1
2 722
Article Hiroshi Sato · Apr 11, 2024 2m read

InterSystems FAQ rubric

If the journal file is too large to be searched or filtered using the Management Portal, you can refer to it using the following two methods.

① How to use the ^JRNDUMP utility
② How to reference it in a program

================================================== ========== 

① Using the ^JRNDUMP utility. For example, if you want to select all records in the journal file that include the global reference ^ABC, do the following:

*Please execute all commands below in the %SYS namespace.

DO SELECT^JRNDUMP("C:\MyCache\mgr\journal\YYYYMMDD.001","","","^ABC",1)

0
0 376
Article Hiroshi Sato · Apr 4, 2024 1m read

InterSystems FAQ rubric

The Web/CSP Gateway management page is typically configured so that it cannot be accessed from client machines.

To access from any client, do the following:

  1. Launch a browser from a system with access to the Web/CSP Gateway management page and access the Management Portal.
  2. Under Management Portal > System Administration > Configuration > click CSP Gateway Management.
  3. Click Default Parameters that appear in the left pane of the page that appears.
  4. Enter *.*.*.* in the system management machine and press the Save Settings button.
0
0 262
Article Hiroshi Sato · Mar 21, 2024 2m read

InterSystems FAQ rubric

Properties defined in list collections (Property XXX As list of %String;) can be manipulated using SQL functions: $LISTBUILD(), $LISTFROMSTRING().

For each SQL function, please refer to the document page below.

InterSystems SQL Reference - $LISTBUILD() [IRIS]
IRIS SQL Reference - $LISTFROMSTRING() [IRIS]
Caché SQL Reference - $LISTBUILD()
Caché SQL Reference - $LISTFROMSTRING()

/// Class definition exampleClass ISJ.ListOfData Extends%Persistent
{
    Property listdata As list Of %String;
}

An example of SQL statement execution is as follows. 

0
0 259
Article David.M · Sep 7, 2016 5m read

HealthShare uses a lot of XSLTs. These are used to convert IHE medical documents to SDA (internal HealthShare format) and back to IHE formats, to create summary reports, and to deal with IHE profiles (e.g., patient information query, document provide and register). Customers may customize the XSLTs to customize reports or for other reasons.

For debugging and development, it is very convenient to be able to run an XSLT from Terminal.

The Class Method

1
4 1555
Article Hiroshi Sato · Mar 14, 2024 1m read

InterSystems FAQ rubric

Record maps are used to efficiently map files containing delimited records or fixed-width records to message classes used by the interoperability function, and to map files from interoperability function message classes to text files.

Record map mapping definitions can be created using the Management Portal, and we also provide a CSV record wizard that allows you to define while reading a CSV file.

To use a record map in production, just add a record map business service or business operation and specify the record map definition class you created.

3
0 429
Article Muhammad Waseem · Mar 10, 2024 6m read

Introduction

Visual Studio Code (VS Code) is a free source code editor made by Microsoft for Windows, Linux, and macOS. It provides built-in support for JavaScript, TypeScript, and Node.js. You can add extensions to provide support for numerous other languages including ObjectScript.

The InterSystems extensions enable you to use VS Code to connect to an InterSystems IRIS server and develop code in ObjectScript. The Visual Studio Code Documentation is an excellent resource on VS Code, so it is a good idea to be familiar with it.

0
0 575