InterSystems states that Caché supports at least three data models – relational, object and hierarchical (globals). On can work with data presented in relational model in a program written on C# the same way one works with any other relational DB. To work with data presented by object model in C# one needs to use .NET Managed Provider or some kind or ORM. And starting with version 2012.2 one can work directly with globals (or use direct access to hierarchical data) via Caché eXTreme for .NET.

4 18
2 1,766
· Mar 3, 2016 2m read
Class Projections and Projection Classes

The purpose of this post is to raise the profile of a powerful mechanism that has long been available to us, and to open a discussion about ways in which it can be used or abused.

You can read more detail about the mechanism here. To summarize, your class definition can use the Projection keyword to reference one or more projection classes. A projection class can implement methods that get invoked at key points in the lifecycle of your class.

8 18
0 1,351

I want to consume external websocket api, URL looks like this:


Checked with external tool (Simple WebSocket Client) that websocket works and I can consume the data.

In Cache the relevant functionality is offered by %IO.Socket class.

set sock = ##class(%IO.Socket).%New()
set sock.SSLConfig = "MyEmptySSLConfig"
set sock.TranslationTable="UTF8"
do sock.Open("<token>","443", 10,.sc)

However I get this error:

0 17
0 1,178
· Jul 30, 2019
Working with $ZF function

Good morning,

I'm trying to understand $ZF function, but only documentation isn't enought in this way. So my question is is there any possibility to get enviroment variable by this function into ensemble?

I've tried this as example from ducumentation, but there is an error and I don't know why...

Thanks for your solutions.


0 17
0 982

I would like to examine the contents of my OBX-5 field and not route the message if it contains alphabetic characters. I've tried various combinations of the Match and Contains functions, with no luck. Should I be using the COS ? operator or plaini regular expressions?


OBX-5 Contains "\D"

OBX-5 Contains "?.A"

OBX-5 Contains "[A-Z]"

0 17
0 1,130

All responses are appreciated. I am new to both scripting and CACHE so please bear with me. I am setting up a nightly backup script for freezing cache then backing it up and then thawing it back out. Currently when I enter the freeze command I am getting a response of access denied even though my id has %all access. I've tried passing the userid/password as a parameter in the externalfreeze command and passing it from a file. I've used my id and lastly I used the _system id in the file. What ID should I use for this or am I passing it wrong?

0 17
0 926
· Feb 5, 2016 11m read
Class Queries in InterSystems IRIS

Class Queries in InterSystems IRIS (and Cache, Ensemble, HealthShare) is a useful tool that separates SQL queries from Object Script code. Basically, it works like this: suppose that you want to use the same SQL query with different arguments in several different places.In this case you can avoid code duplication by declaring the query body as a class query and then calling this query by name. This approach is also convenient for custom queries, in which the task of obtaining the next row is defined by a developer. Sounds interesting? Then read on!

17 17
5 6,461
· Apr 12, 2017 5m read
Bug killing development tips

Does anyone NOT use a debugger? I can't remember the last time I did. It's not because I don't dislike them, I just don't need to use them. The main reason for this is because I have a certain development methodology that either produces less bugs, catches them at a unit test level, or makes tracking them down much easier.

Here are my tips...

1. Write your own COS cheat-sheet.

19 17
6 1,406
· Feb 26, 2018
Copy Files

Hi Guys,

I'm looking to Remove file from a location to another similar to CUT & Past function, I'm using this :

 s file=##class(%File).%New()
 d file.CopyFile(File,ArchivePath)
 d file.Delete(File)

and the copying is happening but not the Deleting, and help pls?


0 16
0 2,074
· Aug 9, 2017
SSL_connect() error

I am trying to send an HTTP request and getting "SSL/TLS error return from SSL_connect()." error (Cache 2013). No modification in SSL/TLS Configuration helped. Could anyone point me in the right direction?


0 16
0 3,081


I believe the simplest is (to work with csv delimited by ";"):

set file = ##class(%File).%New( "data.csv" )
    set sc = file.Open( "R" ) 
    if $$$ISERR(sc) quit    ; or do smth

    while 'file.AtEnd {
        set str=file.ReadLine() 
        for i=1:1:$length( str, ";" ) {
            set id=$piece( str, ";" ,i ) 
            write !, id  // or do smth
    do file.Close()

Possible options:

different variants of error handling with sc code.

Embrace while loop into try/catch block.

And what's yours?

3 16
0 5,847


We are using Cache to generate HTML pages (complete with Javascript), which we are reading in an Android phone App's WebView.

If, when we generate HTML as follows:


<body bgcolor='red'>

Hello World



Reading this is iPad gets what you would expect, a red page with Hello World written in it.

However in Android phone, the page is both white and blank.

0 16
0 267
· Apr 13, 2018
Git behavior

We are going to start using Git within Cache.

One question came up - if the branch that you checked out does not have the class or mac file, what is the correct thing to do?

Should we delete from Cache or should we just keep it?

I'm leaning more towards deleting it because Cache should reflect what is in your work folder in git. But other team members are saying to keep it.

0 16
0 439

Hi all,

I wonder how to sync my server code to my local code using Visual Studio Code.

Previously, using Atelier, you could open a view of server and can copy the code to the current project, also if I change a BP, I could sync the code because I had a signal that It's warning me that there was a change and it needs to be updated.

I thing i shouls opening the ObjectScript: Explorer and select the code directaly, and right click -> Import and compile current file (Ctrl + F7)

If I use this command, the ouptut window shows:

0 16
0 1,424

Hi all!

I'm developing a mini-framework to implement annotations in Cache. I want to support two kind of annotations: metadata and method decorators. I've got stuck trying to implement the second one.


With metadata annotations I can add metadata to any kind of target. A target can be a method/classmethod, parameter, property and class.

For example:

3 16
0 652
· Jun 14, 2016
Get variables list


In Caché there is a way to print all current variables using write command without arguments:

USER>set Einstein = 1879
USER>set Mozart = 1756

But is there a way to get a list of this variables? I am looking for something that would return value like $LB("Einstein", "Mozart") for this case.


2 16
0 1,427