Find

Article
· 2 hr ago 3m read

How to Find a Specific Text in ObjectScript

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.
It can also be spread across multiple namespaces.
In the past, Studio was not yet complete: it was poorly suited, slow, and inaccurate.

I have encountered this situation more than once in different installations.
Source Control was not available at the time, and was only rarely used when it was eventually introduced.

Since ObjectScript was the only possible choice to tackle this challenge, I wrote my own utility.
My solution evolved over the years, and once the migration to IRIS was planned, I checked once again how useful it still was.
And because it was written in pure ObjectScript, it worked in IRIS without a single character needing to be changed.
As you may know, the problem of searching for a specific piece of text in ObjectScript has not changed.

My personal goals for this utility were:

  • ObjectScript only
  • no fancy, miraculous, or fragile constructions
  • as few $advanced functions as possible
  • favor readability over elegance for the sake of future maintenance
  • display the number of occurrences counted per namespace and per code element
  • for classes, also distinguish between:
    • parameters
    • properties (if calculated)
    • methods
    • indices
  • an option to show the line containing the occurrence
  • no concern for listing output:
    • any terminal program can write a log
    • bash has STDOUT for that purpose

This utility is therefore available to you on Open Exchange and GitHub.
I also created a video to demonstrate the tool in action.
It is also available on the Demo Server.

Simply start it from the terminal:
user>DO ^rcc.find

You will then be prompted with a few questions:

  • what text are you searching for?
  • Verbose?
    • do you want to see every full line containing your text?
    • warning: this can become a very large listing
    • a recent test found more than 90,000 matches
    • with verbose=1, you will get more than 90,000 lines
  • Uppercase only?
    • this solves the problem of functions being written
    • in uppercase, lowercase, or mixed case
    • "Uppercase=1" ensures you do not miss any occurrence
  • Which code type do you want to scan? (CLS, MAC, INT, INC, ALL)
  • Which namespace do you want to search?
    • a specific namespace from your list or ALL
    • for ALL, you get a condensed list of namespaces and types
    • (not visible in the video)

Selecting the namespace starts the scan.
Let’s dance!

USER> do ^rcc.find
----------------

enter search string [$ZU] <blank> to exit: RCC
          Verbose? (0,1) [0]:
          Force UpperCase? (1,0) [1]:

enter code type (CLS,MAC,INT,INC,ALL) [ALL]: CLS

select namespace (ALL,%SYS,DOCBOOK,ENSDEMO,ENSEMBLE,SAMPLES,USER) [USER]:

** Scan Namespace: USER **

** CLS **
** 2      User.ConLoad
** 15     User.Main
** 3      csp.form
** 3      csp.winner
** 2      dc.rcc.Contest
** 37     dc.rcc.Main
** 1      dc.rcc.Prize
** 63 CLS **
----------------

I hope you enjoyed my story.
I tried to avoid boring code listings, that’s what Open Exchange and GitHub are for.

And please excuse my rusty French.
I learned it at school many years ago, where the focus was on literature (Molière, Sartre, Queffélec, Anouilh, Ionesco) rather than technology.

Discussion (0)1
Log in or sign up to continue
Question
· 2 hr ago

How can I add an ancestor to a class programmatically?

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?

1 new Comment
Discussion (1)2
Log in or sign up to continue
Question
· 3 hr ago

%SYS.OAuth2.AccessToken - Retrieval

I built a BP, that every time that a message is received from a BS, it executes 

 set isAuth=##class(%SYS.OAuth2.AccessToken).IsAuthorized("EpicFHIRPOC",,,.accessToken,.idtoken,.responseProperties,.error)
 if 'isAuth {
        set tSC=##class(%SYS.OAuth2.Authorization).GetAccessTokenClient("EpicFHIRPOC", "*",, .error)        
         set isAuth=##class(%SYS.OAuth2.AccessToken).IsAuthorized("EpicFHIRPOC",,,.accessToken,.idtoken,.responseProperties,.error)
    }

To save time, I was thinking of just creating a BS that goes out and gets the Authorization Token every hour. However then how to do I pull that Token into the BO to ensure that the Token is included in the Request that is sent to the HS.FHIRServer.Interop.HTTPOperation?

3 new Comments
Discussion (3)2
Log in or sign up to continue
Article
· 3 hr ago 2m read

Exporting Interoperability Configuration data to CSV

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:

  • Which interfaces reference file system paths?
  • Where are directories, network shares, or absolute paths configured?
  • Can I quickly audit or document this information across all my productions?

The ObjectScript utility below solves exactly that problem by exporting selected configuration settings into a CSV file.

This script:

  1. Loops through all existing namespaces
  2. Queries all Interoperability configuration items (Ens_Config.Item) across all namespaces
  3. Iterates through each item’s Settings
  4. Extracts file system/URL paths (values containing :, /, or \)
  5. Writes the results into a CSV file, grouped by Category
  6. Produces an audit-friendly output you can open in Excel or share with operations/security teams

Typical Use Cases

You should use this utility when you need to:

  • 🔍 Audit file system usage across a productions
  • 🛡 Review security exposure (local paths, network shares, database connections)
  • 📄 Document configuration for migrations, upgrades, or DR planning
  • 🔄 Compare environments (DEV vs TEST vs PROD)
  • 🧹 Cleanup legacy or unused paths

This is especially useful in large instances with several productions using many interfaces and adapters.

Output Format

The generated CSV contains the following columns:

Namespace, Category, Item Name, Class Name, Property Name, Value

Additionally:

  • Configuration items are grouped by Category
  • Only relevant settings paths are exported - you can easily change the logic to export using the setting's name (such as "DSN" for SQL connections) or any other setting's value.
  • Easy to filter and analyze in Excel

Run the utility from the terminal and provide the parameter for the full path and csv name.

for example:

> do ##class(Test.Properties).GetData("c:\temp\loop.csv")

Example of the CSV output opened in Excel:

 

Notes & Tips

  • 🧪 Test in non-PROD first if you’re unsure about permissions
  • 📂 Ensure the target directory exists and is writable by IRIS/Health Connect
  • 🔎 You can easily extend the logic to:
    • Export additional properties
    • Filter by category or class
    • Mask sensitive values (passwords)
    • Change logic for relevant data

If you extend or improve it, feel free to share your enhancements with the community.

Discussion (0)0
Log in or sign up to continue
Digest
· 3 hr ago

InterSystems Developers Publications, Week December 22 - 28, 2025, Digest

Articles
Announcements
#InterSystems IRIS
#Developer Community Official
Questions
December 22 - 28, 2025Week at a GlanceInterSystems Developer Community