
In this section, we will explore how to use Python as the primary language in IRIS, allowing you to write your application logic in Python while still leveraging the power of IRIS.
InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.

In this section, we will explore how to use Python as the primary language in IRIS, allowing you to write your application logic in Python while still leveraging the power of IRIS.
Word documents are widely used in the market. Users frequently create contracts, memos, resumes, reports, analyses, and other documents that may require data from or captured by InterSystems IRIS. However, IRIS does not have an API, SDK, library, or adapter for this. This limitation no longer exists.
The new Open Exchange library iris4word (https://openexchange.intersystems.com/package/iris4word) delivers an ObjectScript SDK where the developer passes any %DynamicObject as a parameter, a Word file template and then receives a ready document, with the structure and formatting defined in its template.
.png)
Let's start with a simple motivating question: over the past 14 days, what are my most common errors in the Application Error Log?
Answering this through the management portal or terminal is an annoying manual process - we should just be able to use SQL. Fortunately, there are a few class queries to help with this in the SYS.ApplicationError class in the %SYS namespace. You can answer the question for a single date with something like:
select"Error message"countHi,
I have a code that copy a method to another class for analysis purpose.
I also want this method to appear first in the source code to easily use it in VSCode with the classmethod debug button and not search it in the numerous method of the modified class.
Is there a way to do such a thing?
I tried the placeAfter keyword but I can't find a way to make it really work as I want. Is their other ways to control the order of methods?

Now that we have a good understanding of Python and its features, let's explore how we can leverage Python within IRIS.
Sending emails is a common requirement in integration scenarios — whether for client reminders, automatic reports, or transaction confirmations. Static messages quickly become hard to maintain and personalize. This is where the templated_email module comes in, combining InterSystems IRIS Interoperability with the power of Jinja2 templates.
Jinja2 is a popular templating engine from the Python ecosystem that enables fully dynamic content generation.

This will be a short article about Python dunder methods, also known as magic methods.
Dunder methods are special methods in Python that start and end with double underscores (__). They allow you to define the behavior of your objects for built-in operations, such as addition, subtraction, string representation, and more.
Some common dunder methods include:
__init__(self, ...): Called when an object is created.
%OnNew method in ObjectScript.__str__(self): Called by the built-in function and print to represent the object as a string.Are you curious about how to run Python scripts directly in your InterSystems IRIS or Caché terminal? 🤔 Good news it's easy! 😆 IRIS supports Embedded Python, allowing you to use Python interactively within its terminal environment.
How to access the Python Shell?
To launch the Python shell from the IRIS terminal, simply run the following command:
do##class%SYS.PythonThis opens an interactive Python shell inside the IRIS terminal. From here, you can write and run Python code just as you would in a normal Python environment.

Modules what a topic! We don't have this notion in ObjectScript, but it's a fundamental concept in Python. Let's discover it together.
I see modules as an intermediate layer between classes and packages. Let see it by example.
A bad example :
# MyClass.py
class MyClass:
def my_method(self):
print("Hello from MyClass!")
When you try to use this class in another script, you would do:
# class_usage.py
from MyClass import MyClass # weird, right?
my_instance = MyClass()
my_instance.my_method()
Why this is a bad example?
Working on wrapping an IRIS Cache ObjectScript method that runs for a few seconds. Trying to get UI updates to show BEFORE the method runs in an async/await function. But it seems to be running synchronously rather than asynchronously . So my question is does IRIS/ObjectScript CSP pages support futures with JavaScript or does it run all synchronously.
InterSystems is pleased to announce that version 3.0.5 of the VS Code - ObjectScript extension has been released. This release includes many bug fixes, as well as changes to the telemetry data we collect. Collecting more product usage data helps InterSystems identify and prioritize fixes and enhancements that will have the most positive impact for you, our users. Personally identifiable information (PII) will never be collected, and telemetry can be disabled using the telemetry.telemetryLevel setting. The full list of data points that are collected can be found here
I am trying to catch an exception and write it to the Application Error Log, but cant find any details on how to do this in IRIS health.
Catch ex Set
Cant seem to find the %Logger class either.

This will be a short article about PEP 8, the Python style guide.
In a nutshell, PEP 8 provides guidelines and best practices on how to write Python code.
I am trying to create users who only have `%SQL` Role for the INSTANCE. But I am unable to find any documentation on the ` Security.Users` class.
See:
// Instantiate the Security.Users objectSet ##class sc
I cant figure out the "Namespace" property for this class, let alone assign a password. Any help would be appreciated. Also the `ChangePassword` method does not appear to work.
in order to do analysis on huge data volumes, it is better to take you data to a separate machine for analysis away from the operational machine, so trying to write huge globals or tables into files as is would take a huge space, what could be a solution or best practice ?..in python for instance, there is the pickling option (serializes data to byte string and saves it to a file) to save space, what could be best in object script ?

This will be an introduction to Python programming in the context of IRIS.
Before anything I will cover an important topic: How python works, this will help you understand some issues and limitations you may encounter when working with Python in IRIS.
All the articles and examples can be found in this git repository: iris-python-article
Python is an interpreted language, which means that the code is executed line by line at runtime even when you import a script.
What does this mean ? Let's take a look at the following code:
# introduction.py
def my_function():
print("Hello, World!")
my_function()
Dear community, I have a confession to make. I have not gotten over Zen yet. Alas, all good things must come to an EOF, so I am currently learning about Angular. I am working on proving to myself that with the right back end and Angular components, I can deliver to myself and my team a very Zen-like experience in this environment. Since this is my first attempt, here is a fair warning: I will be providing some rather large code samples before discussing them. Please warm up your mouse and hand for extensive upcoming scrolling!
Hi Developers!
There is a free ObjectScriptQuality tool for ObjectScript developers who upload solutions on GitHub. This tool helps developers validate ObjectScript code using a variety of rules, based on common code errors.
There are currently 16 rules in this tool, but there are definitely many more rules to consider when testing ObjectScript code.
Could you suggest any other rules to add to this tool?
Note: You can submit it as an idea on the InterSystems Ideas for the 2nd Idea-A-Thon contest
Hello my friends,
I have a problem with Objectscript, why the value of address become like this ?
.png)
everything works fine except the Address,
this is my code, do I need something to make this into real address ? should I put something in my code ?
set paper=obj.PAADMPAPMIDR.PAPMIPAPERDR
if '$isobject(paper) continue
set Address=paper.PAPERStName
thank you for your help
Best Regards,
Steven Henry
Hello my friends,
I have a bit problem with date format, I need to display like this DD-MM-YYYY
I've put the objectscript like this : set DOB=$zd(paper.PAPERDob,15)
and the result is
.png)
Why It cannot show the full year, I mean why 99 or 95 why not 1999 or 1995 ?
Thank You
Best Regards,
Steven Henry
Do not let the title of this article confuse you; we are not planning to take the InterSystems staff out to a fine Italian restaurant. Instead, this article will cover the principles of working with date and time data types in IRIS. When we use these data types, we should be aware of three different conversion issues:
I have built a REST operation to submit a JSON Request Body, and in the JSON Response Object, I need to pull out certain values like pureID, portalURL, and under the identifiers array the ClassifiedID that has a term."en_US" = "Scopus Author ID"
{
"count"1My REST Operation looks like...
Method PostSearchPerson(pRequest But when I execute I am getting...
| ERROR <Ens>ErrGeneral: Retrying Message body 9@osuwmc.COM.Request.SearchPerson / 3858480 because response 94@osuwmc.COM.Response. |
I am writing this post primarily to gather an informal consensus on how developers are using Python in conjunction with IRIS, so please respond to the poll at the end of this article! In the body of the article, I'll give some background on each choice provided, as well as the advantages for each, but feel free to skim over it and just respond to the poll.
As most of you are probably aware, Python is currently the most popular programming language among developers around the world - and for good reason.
Hi fellow developers!
Curious if you guys use CreatedAt and LastUpdated properties in your classes?
Created to stamp when the record was created and LastUpdated when it was last updated. Where it can be useful - almost everywhere )) I find it convenient in records sorting (e.g. by creation or last update), in sync (with other systems), and so on, for better analytics.
Do you use it all the time for all the classes?
If don't, why not? What do you use instead?
What property type do you use - %TimeStamp? %DateTime?
What is the best practice to have CreatedAt filled automatically during creation and LastUpdated on every successful save (guess it could be in %OnSave)?
Please share your experience /thoughts?
The below code is not working. its unable retrieve Record count and merge files
Class Util
{
ClassMethod zPyRecordCount(inputfile) As %Integer [ Language = python ]
{
import pandas as pd
import iris
import io
try:
df = pd.read_csv(inputfile, sep='|')
recordcount=len(df.index)
sys.stdout.write(len(df.index))
return recordcount
except Exception as e:
return 0
}
ClassMethod zPymergefiles(file1, file2, outputfilename) As %Boolean [ Language = python ]
{
import pandas as pd
import iris
import io
try:
dataframe1=pd.
Hi noble devs!
Just building a simple frontend->JSON->IRIS backend story, and figured that IRIS while importing via %JSON.Adaptor wants JSON fields to match property names, meaning even should match the case. Like:
{ name: "John""Doe"will have issues while saving the dynamic object to a class Sample.Person with:
%Persistent%StringAs soon as the case is not the same...
Is there any setting to fix this?
Hi all,
We're developing a medical appointment app that connects doctors' schedules to an appointment provider.
The provider is returning us the appointment in the following format:
Thu Jul 03 08:20:00 CEST 2025
It means, 03 july 2025 at 08:20:00 Central European Summer Time (UTC+2)
But we need the following format:
2025-07-03 08:20:00+02:00
Is there any option to convert zone time code (CEST) to a UTC+x ?
How to convert zone time code (CEST, CET, ET, EDT, etc..) in its zone time in UTC (UTC+2, UTC+1, UTC-5, etc..) ?
Best regards
This can be achieved by using the CSV() procedure of the %SQL.Util.Procedures class.
Below is an example of usage code. (Assuming that the file test.csv is in c:\temp.)
Hello,
I have a problem generating QR code in Caché now.
After executing the code
set Status=##Class(%SYS.QRCode).GenerateImage(P0,,.DataURI)
(variable P0 contains data for QR code)
an error is displayed now:
"<NOTOPEN>zGenerate+27^%SYS.QRCode.1",,,,,,,,
("$^zGenerate+27^%SYS.QRCode.1 +1","$^zGenerateImage+4^%SYS.QRCode.1 +1"
This error occurs only on two servers, on the others the code works fine.
When calling the method, I do not specify any external file that should be opened.
Thank you for the answers.