Could someone help me with this error?
.png)
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.
Could someone help me with this error?
.png)
I have a new project to store information from REST responses into an IRIS database. I’ll need to sync information from at least two dozen separate REST endpoints, which means creating nearly that many ObjectScript classes to store the results from those endpoints.
Could I use ChatGPT to get a headstart on creating these classes? The answer is “Yes”, which is great since this is my first attempt at using generative AI for something useful. Generating pictures of giraffes eating soup was getting kind of old….
I have a Photo that is stored as an VARBINARY within MS SQL. I would like to Select the data into a EnsLib.SQL.Snapshot, is that possible? I would take it out of the Snapshot and send it to a %Stream so it can be written out to a file.
Hi Developers!
Sometimes we need to deal with classes/tables where the primary key and the IdKey are something that is maintained by yourself.
What is the proper way to generate a new ID in case where ID is a %BigInt?
Property id As %Library.BigInt
Are there any system methods to provide it?
There is data already imported via SQL, so there is no last ID stored in ^myclassD, so I cannot do $I(^myclassD).
Thinking of:
set newid=$O(^myclassD(""),-1),newid=$I(newid)What do you think?
Defining my first REST API within InterSystems using iris-rest-Api-template as a basis and I am seeing if someone could provide me some guidance to see if I can make it work.
In some of my other posts, I have been trying to come up with a way for our Enterprise Application Development team which works with .Net to build Applications to make a REST call to our instance of InterSystems to query some of the Cache Tables we have defined.
Using the iris-rest-api-template, I have created the osuwmc.DataLookup.REST.Base.cls
Class osuwmc.DataLookup.REST.Base Extends %CSP.The demo is based on the raw class descriptions.
The data classes used are Address, Person, Employee, Company
For a more attractive demo, a JSONtoString method by ID was added.
I have been struggling sometime with trying to take a FHIR Bundle Response, extract the "entry.resourceType", extract the MRN and Name from the Patient FHIR Response...
Going through learning.intersystems.com, it suggested that I try using fhirPathAPI to parse and search my response for certain values, however I am not sure my syntax is correct. Using the AI code, it suggested to set my tree = "Bundle.entry.resource.resourceType"
ClassMethod Transform(source As HS.FHIRServer.Interop.Response, target As osuwmc.Epic.FHIR.DataStructures.Hi Developers!
Consider I have a persistent class derived from %Persistent and I want it to be derived from %JSON.Adaptor to enjoy all the JSON features.
Can I do it programmatically?
So, it'd be wonderful to have a method in some util class that makes it happen? Something like:
Do ClassUtil.AddAncestor("MyPackage.MyPersistentClass","%JSON.Adaptor")
Any ideas?
You probably know this situation:
Some time ago, you found a very special $ZU function for a very specific type of problem. Some kind of mystical formula. It became popular and was used by many developers throughout your code and across all your installations.
Several versions and updates later, you are informed by ISC that your mystical $ZU is deprecated and no longer supported. You are advised to replace it with a new $something().
So, how do you find and document the usage of this mysterious code?
It might be located in classes, in MAC, INT, or INC code.
When working with InterSystems Interoperability (Iris / Health Connect / Ensemble), configuration data is often spread across many production items: services, processes, operations, adapters, and their settings.
A common operational or security need is to answer questions like:
The ObjectScript utility below solves exactly that problem by exporting selected configuration settings into a CSV file.
Here is what is currently used.
..CurrentDateTime("%Y%m%d%H%M%S")
The format is not the issue.
I need to make it our current time as it is five hours ahead.
How can I access the header property of either of these.
.png)
Or, if I can't do that, subtract five hours or the equivalent time in seconds.
example, if I receive 20201224161922, how can I make it 20201224111922?
Thanks,
Jonathan
Overview
Embedded Python is a game-changer for InterSystems IRIS, offering access to the vast Python ecosystem directly within the database. However, bridging the gap between ObjectScript and Python can sometimes feel like translating between two different worlds.
To make this transition seamless using embeddedpy-bridge.
This package is a developer-centric utility kit designed to provide high-level ObjectScript wrappers, familiar syntax, and robust error handling for Embedded Python.
Hi developers!
There is a neat feature of ObjectScript classes - Query element, which allows you to write in a clear SQL (without any & or ()), pass parameters to it and call it from ObjectScript as do QueryNameFunc() or via Call SQLProcedureName via SQL, .e.g.
Query MyQuery(p as %String) as %SQLQuery [SQLProc]
{
SELECT * FROM MyTable
WHERE Name=:p
}All works fine, but when I tried to use the same for a DELETE statement see the following error:
SELECT expected, DELETE found ^ DECLARE Q1 CURSOR FOR DELETE
Is the Query element for SELECT only? What am I doing wrong? )
I am trying to centralize our FHIR queries into a single BP object that would send the FHIR query to the EMR, interpret the response into a %Persistent structure that could be sent back to the requestor. In theory it seemed like it would work but I am running into an issue..
"Warning on Message body 5@osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record'
/ 229 because Status 'ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>Transform+3 ^osuwmc.Scott.FHIR.DemoOutboundHL7Message.1 *DocType,osuwmc.Epic.FHIR.DataStructures.PatientSearch.Record -- logged as '-'
Hi developers!
Happy holidays!
In ObjectScript there is neat option to log errors - call Log() method of an exception intance, e.g.:
ClassMethod MyMethod() {
Try {
w 1/0
}
Catch e {
do e.Log() // logging error in the app log
write "the error happened: "_e.DisplayString()
}
}Is there anything like that for Embedded Python? e.g:
ClassMethod MyMethod() [Language = python] {
try:
print(1/0)
except ZeroDivisionError as e:
// how can I log e into IRIS App Error Log here?
print("Caught exception: " + str(e))
}Any ideas?
Hello!!!
Data migration often sounds like a simple "move data from A to B task" until you actually do it. In reality, it is a complex process that blends planning, validation, testing, and technical precision.
Over several projects where I handled data migration into a HIS which runs on IRIS (TrakCare), I realized that success comes from a mix of discipline and automation.
Here are a few points which I want to highlight.
1. Start with a Defined Data Format.
Before you even open your first file, make sure everyone, especially data providers, clearly understands the exact data format you expect. Defining templates early avoids unnecessary bank-and-forth and rework later.
While Excel or CSV formats are common, I personally feel using a tab-delimited text file (.txt) for data upload is best. It's lightweight, consistent, and avoids issues with commas inside text fields.
PatID DOB Gender AdmDate
10001 2000-01-02 M 2025-10-01
10002 1998-01-05 F 2025-10-05
10005 1980-08-23 M 2025-10-15Make sure that the date formats given in the file is correct and constant throughout the file because all these files are usually converted from an Excel file and an Basic excel user might make mistakes while giving you the date formats wrong. Wrong date formats can irritate you while converting into horolog.
Developing and testing REST APIs in InterSystems IRIS often requires a significant amount of boilerplate code. While ObjectScript provides powerful tools for building APIs, writing consistent and repeatable tests can be time‑consuming. This is where IrisOASTestGen comes in.
IrisOASTestGen is a utility designed to generate the structure of test classes and the supporting utility code directly from an OpenAPI 2.0 specification
In this article, we will discuss all the debugging tools included in the Microsoft Visual Studio Code IDE.
What will be covered:
Let's start by learning about debugging requirements!
Prerequisites
There are two plugins (extensions) for debugging ObjectScript:
The first is part of the InterSystems ObjectScript Extension Pack. The second is Serenji, a standalone plugin that provides an editor, file manager, and debugging functionality. Both plugins can be installed from the plugin store. To activate key functionality, Serenji requires a license. For this article, we'll use the InterSystems ObjectScript Extension Pack to reduce the learning curve. After you've mastered the basics, you can consider purchasing a paid license for Serenji.
When I was younger (a question about exactly how much younger is outside the scope of this article), the word “token” meant fun. You see, just a couple of times a year, I would get to go to an arcade and play some amusing video games with my friends.
These days, tokens signify security. JSON Web Token (JWT) Authentication has become one of the most popular standards for securing REST APIs. Fortunately for IRIS users, we have a straightforward way to set up applications to be protected this way. Yet, the idea is still similar to my old arcade days.
InterSystems FAQ rubric
If you try to kill a global that is mapped at the subscript level from the top node, you will get a <SLMSPAN> error and it will not be deleted. This is because the kill command for subscript-level mapped globals cannot be used across mappings.
// Suppose subscript-mapped globals exist in different databases, as shown below:
^TEST(A*~K*) -> database A
^TEST(L*~Z*) -> database B
// Trying to kill from the top level will result in a <SLMSPAN> error.
NAMESPACE>Kill ^TEST
<SLMSPAN> <- This error is output.Using a Workflow Task within HealthShare Provider Directory, when a user clicks on Resubmit message within my Business Process, I check the status of the response. If the response is "Resend Message", I have my Business Process executing the following....png)
set tSC = ##class(Ens.MessageHeader).ResendDuplicatedMessage(context.SessionID)
if $$$ISERR(tSC) $$$LOGSTATUS(tSC)the context.SessionID is the Session ID of the message as it is being pass thru the Business Process. Does anyone see why that would not work off hand?
Hi,
I need a simple function for formatting a string, like in Python or C#. That's easy:
Class Very.Very.Long.Class.Name
{
ClassMethod Format(fmt As %String, args...) As %String [ Language = python ]
{
return fmt.format(*args)
}
}
To simplify calls, I want to wrap the function into a macro:
ROUTINE StringUtil [Type=INC]
#define FMT(%fmt,%a0) ##class(Very.Very.Long.Class.Name).Format(%fmt,%a0)
/// #define FMT(%fmt,%a0,%a1) ##class(Very.Very.Long.Class..png)
As AI-driven automation becomes an essential part of modern information systems, integrating AI capabilities into existing platforms should be seamless and efficient. The IRIS Agent project showcases how generative AI can work effortlessly with InterSystems IRIS, leveraging its powerful interoperability framework—without the need to learn Python or build separate AI workflows from scratch.
This project explores how ChatGPT and Anthropic Claude, two of the most advanced AI models, can interact with IRIS using Custom GPTs and the Model Context Protocol (MCP).
The previous article introduced IrisOASTestGen, a tool designed to generate REST API test code for InterSystems IRIS based on OpenAPI 2.0 specifications. It demonstrated how to scaffold test cases using the default templates bundled with OpenAPI Generator.
This follow-up focuses on the next natural step: customizing the generated test code. By extending the code generation logic with Mustache templates, it becomes possible to express richer semantics, implement CRUD-aware tests, and create more meaningful test suites.
Hello!
I have the following XML document obtained through a string:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MainDocument xmlns="urn:hl7-org:v3">
<realmCode code="IT"/>
<title>kjbkjkjbkjb</title>
<effectiveTime value="20090905150716"/>
[.....other tags.....]
<versionNumber value="1"/>
<component>
<body>mhvjhjkvhj</body>
<component>
<section>content</section>
<ID>5</ID>
<title>Certificato</title>
<text/>
<entry>
<Id>5</Id>
[...other tags...]
</entry>
<entry>
<Id>6</Id>
Validating JSON data against JSON Schema is a common requirement for modern applications. FastJsonSchema brings this capability natively to InterSystems IRIS, combining speed, simplicity, and full schema compliance.
Unlike traditional validation approaches, FastJsonSchema generates native ObjectScript code from your JSON Schemas and compiles it directly to iris object code, enabling idiomatic performance without relying on external libraries or runtimes.
InterSystems IRIS provides extensive configurable security options, yet many developers primarily use roles and resources to secure entire tables or routines. Today, we will delve deeper. We can also secure individual columns and rows separately, but these two mechanisms operate very differently. Let's begin with the columns.
Column Security
For testing and demonstration, we will keep our table structure concise and straightforward. We have a table called "Person" in the USER namespace that contains an ID column, a date of birth column (DOB), first name, and last name.
There's a pattern I've encountered several times where I need to use a temp file/folder and have it cleaned up at some point later.
The natural thing to do here is to follow the patterns from "Robust Error Handling and Cleanup in ObjectScript" with a try/catch/pseudo-finally or a registered object to manage cleanup in the destructor. %Stream.File* also has a "RemoveOnClose" property that you can set - but use with care, as you could accidentally remove an important file, and this flag gets reset by calls to %Save() so you'll need to set it back to 1 after doing that.
There's one tricky case, though - suppose you need the temp file to survive in an enclosing stack level. e.g.:
A unit of ObjectScript code (a ClassMethod, say) may produce a variety of unexpected side effects by interacting with parts of the system outside of its own scope and not properly cleaning up. As a non-exhaustive list, these include:
Use of these important language features without proper cleanup and defensive coding can lead to an application that normally works correctly, but that may fail in unexpected and difficult-to-debug ways.
Since the introduction of Embedded Python there has always been doubt about its performance compared to ObjectScript and on more than one occasion I have discussed this with @Guillaume Rongier , well, taking advantage of the fact that I was making a small application to capture data from public competitions in Spain and to be able to perform searches using the capabilities of VectorSearch I saw the opportunity to carry out a small test.