As a developer, you have probably spent at least some time writing repetetive code. You may have even found yourself wishing you could generate the code programmatically. If this sounds familiar, this article is for you!

We'll start with an example. Note: the following examples use the %DynamicObject interface, which requires Caché 2016.2 or later. If you are unfamiliar with this class, check out the documentation here: Using JSON in Caché. It's really cool!

20 2
3 3K
Article
· 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
6 7K

In my previous article, we reviewed possible use-cases for macros, so let’s now proceed to a more comprehensive example of macros usability. In this article we will design and build a logging system.

Logging system

Logging system is a useful tool for monitoring the work of an application that saves a lot of time during debugging and monitoring. Our system would consist of two parts:

  • Storage class (for log records)
  • Set of macros that automatically add a new record to the log

15 6
9 2.9K

1.Background

1.1 I met a few project that their interface servers were crashed. Cutoms wanted resume server as fast as we can. their servers are running at lan,and they can't use git,there are some namesapce in the server running different service,and usualy there is only one server.

1.2 In the message,it has property in type of characterstream,as you know,the message search page doesn't support filtering with property of characterstream,so it's so hard to find the messge you want.

10 11
2 555
Article
· Oct 18, 2016 7m read
Macros in the InterSystems Caché

In this article I would like to tell you about macros in InterSystems Caché. A macro is a symbolic name that is replaced with a set of instructions during compilation. A macro can “unfold” in various instruction sets each time it is called, depending on the parameters passed to it and activated scenarios. This can be both static code and the result of ObjectScript execution. Let's take a look at how you can use them in your application.

9 3
0 2.2K
Article
· May 20, 2017 10m read
Localization in Caché DBMS

This is a translation of the following article. Thanks @Evgeny Shvarov for the help in translation.

Let's assume that you wrote a program that shows "Hello World!", for example:

  write "Hello, World!"

The program works and everyone is happy.

With time, however, your program becomes more complex, gets more features and you eventually need to show the same string in different languages. Moreover you don't know the number and names of these languages.

The spoiler below contains a description of how the task of multi-language localization is solved in Caché.

8 1
1 980

Here you have an easy way to write and execute COS code from your unix scripts. This way one does not need to write routines or even open Studio or Atelier. It can be an option for simple and small actions for instance things like installation tasks or compiling.

See sample bash script (compile.sh) to compile classes:

6 2
0 861

Greetings! This article describes yet another simple way of creating installers for the solutions based on InterSystems Caché. The topic covers applications, which can be installed or completely removed from Caché with one action only. If you are still documenting installation instructions that have more than one step to do to install your application — it’s high time you automated this process.

5 14
0 1.6K

On the back of my recent post on writing bug-less code I wanted to raise a few suggestions (to ISC) that would help prevent certain types of bugs at compile time. I've probably missed a few, but these are the main ones in my mind. Please contribute more suggestions.

Btw, these also serve as potential gotchas for new COS developers.

4 24
0 1K

The attached file contains an example of code generation using ObjectGenerators which builds a very simple homemade RuleEngine.

Code generation is an excellent way of increasing performance moving run-time calculations to compile-time.

We could generate code creating routines or implemeting methods using ObjectGenerators. In this example we are using ObjectGenerators.

Update: Rule Engine is now on GitHub https://github.com/intersystems-ib/cache-iat-ruleengine

4 0
0 808

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.

Metadata

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 675
Article
· Dec 7, 2015 4m read
Source Control Hooks and Atelier

So another topic that has been of interest to a number of people since the beta was put up last week is in regard to Studio Hooks and Atelier. This requires a bit of background and then some discussion of how the architecture of Atelier necessitates some changes and then what our current thinking on the subject is.

3 12
0 1.2K

Using our cool new debugging extension for Visual Studio Code I'm trying to debug a CreateProjection method of a class, but when I compile it the work apparently gets done in one of the worker jobs, so my breakpoint never triggers.

Is there a compiler flag or qualifier to force the compilation to be done in-process rather than getting handed off to a worker job?

2 4
0 440

How to understand what's wrong with compilation if the compilator just hides errors?

Compilation started on 05/15/2023 15:58:11 with qualifiers 'cuk'

Detected 1 errors during compilation in 0.003s.


Compilation started on 05/15/2023 15:58:32 with qualifiers 'cuk'

Detected 1 errors during compilation in 0.002s.


Compilation started on 05/15/2023 15:58:51 with qualifiers 'cuk'

Detected 40 errors during compilation in 0.089s.

40 errors, and what do I have to do with this so valuable information?

1 10
0 247
Question
· Jun 21, 2016
Atelier - newbie troubles

I have just imported our Ensemble project (not a really big one, like two man-years) into my MacBook Air Ensemble 2016.3 instance to test many things (document model, etc.), Atelier among the others.

The "Production view" is not here, and I miss it.

The opening of Diagram Editor for BP is pretty hidden. I would even like having a switch, which would default to the Diagram Editor.

Anytime I click on the Open Diagram Editor, it waits for a while, ten produces an error and only then I can see the diagram.

1 2
0 498

When I try to compile through Atelier (Compile Project), I noticed that in compilation with error it returns this message 'Failed to read /api/atelier/v1/ ...':

No additional Atelier files to synchronize.
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck
Compile failed: Failed to read /api/atelier/v1/ERP/action/compile?flags=ck

1 6
0 615

I'm looking at adding multilingual support to a couple of open source projects I'm working on. The solutions are already developed in CSP so I am not looking for alternative approaches.

I'm wondering what would be the best approach for CSP and separate JavaScript files.

Initially I was wondering if I should bake the default system language text at compile time, or provide the end user with a language selection option at run time.

I came across $$$TEXT reading the docs...

1 20
0 504

The class %Compiler.UDL.TextServices arrived in 2015.1, bringing us methods for exporting a class in UDL format (i.e. looking just like we're used to seeing it in Studio), and importing a UDL format definition back into a namespace. Some source control tools including our Deltanji are now able to use UDL format, resulting in diffs that are easier to understand.

1 1
0 306

Hello dear developers,

I am currently doing an internship and learning about InterSystems IRIS and ObjectScript and have downloaded and installed the community version of IRIS.

I have not made any changes in the Management Portal.
In Visual Studio Code I have loaded the InterSystems ObjectScript Extension Pack.

If I now want to compile a file, VSC throws an error:
"ERROR #16006: Document name 'x.csp' is invalid"

0 11
0 139

Occasionally, in VSCode, compile errors stop displaying. I'll be getting errors on compile all along (expected, and it compiles while saving using CTRL+S), until they'll suddenly stop. I haven't found any solution, including restarting VSCode and restarting my user session in Fedora. I'm running IRIS locally on Fedora and running VSCode also on the same machine. The only solution I've found is to restart IRIS. It's a solo dev environment and relatively small, so restarting isn't anything but an annoyance.

Are there any known bugs around this or any other solutions?

0 1
0 103

Is CR/LF changes to DTL files edited/committed to git via VS Code a known issue?

We had an issue with exporting files from one server and importing on another, using XML code exported from Studio: ERROR #6301: SAX XML Parser Error. Turns out that issue was down to CR/LF changes made when transferring the XML from one server to the other.

0 2
0 147