#Tips & Tricks

0 Followers · 317 Posts

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

Article Hiroshi Sato · Mar 7, 2024 1m read

InterSystems FAQ rubric

You can use the %IndexBuilder class to perform index rebuilding using multiple processes.

Here is an example for the purpose of defining the standard index HomeStateIdx for the Home_State (state information of contact address) column of Sample.Person.

The steps are as follows:

1. Hide the index name to be added/rebuilt from the query optimizer.

>write$system.SQL.SetMapSelectability("Sample.Person","HomeStateIdx",0)
1

2. Add %IndexBuilder to the rightmost superclass of the class definition that defines the new index.

0
0 264
Article Guillaume Rongier · Feb 29, 2024 26m read

The objective of the article is to provide the reader with the following informations:

  • Configure and use the FHIR server
  • Create an OAuth2 Authorization Server
  • Bind the FHIR server to the OAuth2 Authorization Server for support of SMART on FHIR
  • Use the interoperability capabilities of IRIS for Health to filter FHIR resources
  • Create a custom operation on the FHIR server

Schema of the article:

Schema

0
0 433
Article Hiroshi Sato · Feb 29, 2024 1m read

InterSystems FAQ rubric

Global mappings can be registered using the system class Config.MapGlobals.

The method to globally map ^Sample.PersonD in a database SAMPLES other than the default database from the namespace USER is as follows (example executed in a terminal).

USER>zn"%SYS"%SYS>set ns="USER"%SYS>set glo="Sample.PersonD"%SYS>set vals("Database")="SAMPLES"%SYS>set st=##class (Config.MapGlobals).Create(ns,glo,.vals)

The third argument of the Create() method of the Config.MapGlobals class is passed by reference, so specify it by appending a period (.) to the variable name.

0
0 284
Article Robert Cemper · Feb 24, 2024 2m read

I want to address the nasty problems about reading a flat text in ASCII, UTF*
explicitly excluding HTML, EBCDIC, and other encoding.
According to Wikipedia there are at least 8 variations of control characters.

  • CR+LF is typical for Windows
  • LF is typical for the Linux/UNIX world
  • CR is Mac's favorite

As you can deduct from the names the inspiration comes from mechanical typewriters.

0
0 464
Article Mihoko Iijima · Feb 22, 2024 2m read

InterSystems FAQ rubric

To remove InterSystems products installed on your Windows system, use Add or Remove Programs in Control Panel (in Windows 10, select Apps from Windows Settings).

Since we will be making changes to the system, you will need to log in as a user with administrator privileges.

1) Log in to the system as an administrator.

2) From the system tray, exit the launcher of the InterSystems product instance you want to uninstall (click launcher → exit).

3) Add or Remove Programs in the Control Panel (for Windows 10, select Apps from Windows Settings)

0
0 385
Article David Hockenbroch · Feb 19, 2024 7m read

“I have been waiting for thirty seconds for service. This is outrageous! I am leaving!”

“I am very sorry to hear that, sir. Perhaps, next time, you should make a reservation.”

If you heard that comment at your favorite restaurant, you would think the person saying it was being ridiculous. However, in the context of your API, it makes perfect sense. Just like your favorite eatery, your API has some regular patrons who, as you know, will be visiting one day or another. It would be great to be able to make a standing reservation for them as well.

0
0 505
Article Hiroshi Sato · Feb 15, 2024 2m read

InterSystems FAQ rubric

The $ZF(-100) command is used in the following format.

$ZF(-100, flags, command name, command arguments)

The "/shell" flag is required when running OS commands.
For example, use mkdir like this:

 // mkdir C:\temp\newdir
 Write$ZF(-100, "/shell", "mkdir", "C:\temp\newdir")


If a command has multiple arguments, enclose them in double quotes and separate them with commas, as in the example below.

0
0 299
Article Mihoko Iijima · Jan 25, 2024 4m read

InterSystems FAQ rubric

If the system does not stop for 24 hours, old journal files will be deleted at 0:30 according to the "Journal file deletion settings".

A possible cause of journal files remaining that are older than the "Journal file deletion settings" is that there are transactions that remain open.

In that case, you will be able to delete the journal file by searching for processes executing transactions and finalizing the transactions.

The sample below checks for the existence of open transactions, and if they exist, outputs the target file name and journal record information.

3
2 323
Article Hiroshi Sato · Jan 18, 2024 1m read

InterSystems FAQ rubric

If you need to migrate your server for some reason, you can reduce the setup work by copying configuration information from the pre-migration environment to the post-migration environment.

The following setting information can be migrated.

  • iris.cpf
  • SQL gateway settings
  • web gateway settings *Note 1
  • user-created routines etc. stored in the IRISSYS database *Note 2
  • security settings
  • task settings
1
2 261
Article Anssi Kauppi · Jun 30, 2020 3m read
Many organisations implement centralised log management systems to separate and centralise the log data in order to e.g. automate threat detection (and response) and to comply with regulatory requirements. The primary systems of interest are the various user facing applications, but increasingly also other kinds of systems including integration platforms.
2
2 488
Article Megumi Kakechi · Jan 11, 2024 2m read

InterSystems FAQ rubric

This error occurs when an instance of the class is already open at compile time.

There are two ways to deal with this issue:

  1. Terminate the process or application that has the instance open
  2. Compile options in the studio build menu: Check the compile flag “Compile classes in use” and compile.  

If you want to determine which process is using the class, try the sample routine below.

1
0 189
Article Evgeny Shvarov · Apr 4, 2023 2m read

Hi developers!

As you know InterSystems IRIS besides globals, object, document and XML data-models also support relational where SQL is expected as a language to deal with the data.

And as in other relational DBMS InterSystems IRIS has its own dialect.

I start this post to support an SQL cheatsheet and invite you to share your favorites - I'll update the content upon incoming comments.

Here we go!

26
7 1438
Article Megumi Kakechi · Jan 4, 2024 1m read

InterSystems FAQ rubric

If a relationship is set and there is a large number of n in a 1:n ratio, a large amount of memory may be consumed due to sequential processing of the relationship.

After referencing a many-sided object in a program and internally swizzling it, simply releasing the variable containing the OREF (deleting it, setting another value, etc.) will not free the many-sided object and the relationship object. This is the cause.

0
0 290
Article Jose Ruperez · Oct 11, 2016 4m read

Now, let’s say you can’t access the terminal or simply you just rather execute it from a web interface. In this article, I will show you how to execute terminal commands from a simple web page.

For example, in the image below you see how we execute $zv on a webpage:

This is mostly possible due to the XECUTE command in Caché ObjectSCript. This command takes a string as a parameter and tries to execute it. This is the command used from the webpage, to execute what is being passed from the left navigation menu.

7
0 32571
Article Mihoko Iijima · Dec 28, 2023 1m read

InterSystems FAQ rubric

There is no need to recompile the routines after the version upgrade, but since the version update overwrites %SYS, user-created INT and OBJ format routines (*.INT,*.OBJ) in %SYS will be deleted. Therefore, you need to be careful. 

MAC, INT and OBJ routines with the following names are not deleted.

%Z*.INT, %z*.INT, Z*.INT,z*.INT
%Z*.OBJ, %z*.OBJ, Z*.OBJ,z*.OBJ

Please note that classes/CSPs need to be compiled after upgrading.

However, if you are upgrading to a maintenance release, no compilation is required. For details, please refer to the document below.

0
1 224
Article Mihoko Iijima · Dec 21, 2023 1m read

InterSystems FAQ rubric

If multiple InterSystems products are installed on the same system, the latest version of the InterSystems ODBC driver among the installed products will remain registered in the driver manager.

You can change to any driver by changing the registry entry below.

 Please note that running RegFiles.bat does not change the ODBC driver.

The registry entry is as follows.

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\InterSystems ODBC35 key Driver
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\InterSystems ODBC35 key Setup
0
0 346
Article Megumi Kakechi · Dec 7, 2023 2m read

InterSystems FAQ rubric

To resolve the error <PROTECT>, remove the read-only attribute of the system-wide library database (IRISLIB for InterSystems IRIS, CACHELIB for Caché/Ensemble/HealthShare (Caché-based))

Once you have finished importing the routine, remember to change it back to read-only.
 

[Version 2013.1 and above]
[Management Portal] > [System Administration] > [Configuration] > [System Configuration] > [Local Database] Uncheck "Mount read-only" from the database name link.

3
0 464
Article Mihoko Iijima · Nov 30, 2023 3m read

InterSystems FAQ rubric

Class definitions created by users are stored in class definition classes. They can be used to obtain a list of class definitions from a program.

Note: Class definition classes refer to all classes contained in the %Dictionary package.

In the sample code below, a list of class definitions is obtained using the query Summary of the class %Dictionary.ClassDefinitionQuery.

2
0 526
Article Megumi Kakechi · Nov 23, 2023 1m read

InterSystems FAQ rubric

When executing OS commands, use $ZF(-100).

do$ZF(-100,"",program,args) // Execute the Windows command [synchronously].
do$ZF(-100,"/ASYNC",program,args) // Executes a Windows command [asynchronously].

When executing OS shell commands such as mkdir and copy, also specify /SHELL.

do$zf(-100,"/shell /async","mkdir","c:\temp\x")

Please refer to the following documents for details:

About $ZF(-100) [IRIS]
About $ZF(-100)

2
1 453
Article Robert Cemper · Nov 19, 2023 2m read

There are situations when your only access to a server is using a web browser,
and there is just no chance of a Terminal or Console access.
The Online Demo Server is such a case.

So you have WebTerminal. That's fine for ObjectScript and Embedded Python.

But my demo is straight Java. And is interactive.
$ZF(-100...) is some aproach. But it's rater batch-oriented and not interactive.
@Enrico Parisi  presented a nice extension to WebTerminal recently.
It's close to my own packageWebCommand that I presented a year ago.

0
0 169
Article Tomoko Furuzono · Jun 1, 2023 1m read

InterSystems FAQ rubric

You can set the maximum size of the IRISTemp database at IRIS startup by setting a configuration parameter called MaxIRISTempSizeAtStart.

After setting, the system will truncate IRISTemp to the set value (MB) at the next IRIS startup. If the current size is less than the specified MaxIRISTempSizeAtStart, no truncation will occur. Also, if 0 is specified, truncation will not be performed, so the size will start without changing. (Default) Settings are made from the menu below.

1
0 656
Article Tomoko Furuzono · Nov 16, 2023 2m read

InterSystems FAQ rubric

To run an online backup from a command you can use the API BACKUP^DBACK routine.
An example of performing a full backup is as follows.

set  status = $$ BACKUP ^DBACK( "" , "F" , "full backup" , "c:\backup\full.cbk" , "Y" , "c:\backup\full-log.log" , " NOINPUT" , "Y" , "Y" , "" , "" )

The return value is 1 if the backup is successful, and 0 if the backup is unsuccessful. Please refer to the log file for details on failure.

Additionally, you can specify C for the second argument TYPE to specify a cumulative backup, and specify I to specify a differential backup.

0
0 303
Article Mihoko Iijima · Nov 9, 2023 1m read

InterSystems FAQ rubric

To create a user-defined error you need to prepare the XML that describes the error code and corresponding message that you want to use as a user-defined error.

Please set the error code as a negative integer.

<?xml version="1.0" encoding="UTF-8"?> 
<MsgFileLanguage="en"><MsgDomainDomain="UserErrors"><MessageId="-111"Name="MyError">An error has occured</Message> 
    <MessageId="-222"Name="MyError2">An error has occured 2</Message> 
  </MsgDomain></MsgFile>

Once the XML file is created, load it into the namespace you want to use.

2
2 641
Question Colin Brough · Nov 13, 2023

We are successfully using System Default Settings to manage differences in settings across environments where the production and underlying code are otherwise identical. However, the TestingEnabled and LogGeneralTraceEvents settings don't appear to be settable via this mechanism. While we appear to be able to set them on the SDS page, they do not show up as selectable when resetting the settings on the Production Settings tab in the management portal - see screenshots below. Is there any way of managing these two settings so we can have development and test servers running with TestingEnabled

3
0 262
Article Steve Wilson · Nov 3, 2016 2m read

I was recently asked whether we have a function to convert LDAP date time stamps into $HOROLOG format or other formats and the answer is not at the moment, but there is a simple method to do the conversion.

Let us look at the facts and figures involved...

1) Active Directory's (AD) date 0 (zero) is 1601-01-01 00:00:00.000 or January 1st, 1601 at midnight (00:00:00)

2) AD timestamps are calculated as the number of 100 nanosecond intervals from date 0

3) 864000000000 is the number of 100 nanosecond intervals per day

1
0 1175
Article Mihoko Iijima · Nov 2, 2023 3m read

InterSystems FAQ rubric

For routines (*.mac)

You can hide the source by exporting/importing only the *.obj that is generated after compiling the source program.

The command execution example specifies EX1Sample.obj and EX2Sample.obj, which are generated by compiling EX1Sample.mac and EX2Sample.mac, as export targets and exports them to the second argument file.

After moving to another namespace, I am using the exported XML file to perform the import.

1
0 597
Article David Hockenbroch · Oct 4, 2023 8m read

We are back to %SYS once again! Since we covered managing users and resources in the last two articles, we can finally move on to roles. As you may have guessed, there are a lot of methods of managing them that you have already seen in our previous writings. However, we can still encounter key differences in this particular class.

3
4 621