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

hi-

Can someone give me an example of how to JOB a class method that requires an array of values to be passed to it by reference.

This is what I tried, but am getting compile errors because of the .params

job ##class(%SYSTEM.OBJ.FM2Class).All(.params)::5

Any thoughts on how to accomplish this, the simplest way. I would like to avoid writing all of this to some global and having to write some wrapper to pick it up and then call the class method, which I certainly could do. but is this the only way to do it?

0 9
1 1.3K

I am currently trying to add a condition to a routing rule that uses the %Source property of a routing rule. Unfortunately I am getting compile errors when I use the "%", and if I get PROPERTY DOES NOT EXIST if I try and use any of field. I have tried referencing the messages as "Message." , "Record.", "FullRecordMapClassName." , "Document." . Does anyone know how to reference the properties of a record map in a routing rule, or if it is even possible? Thanks!

0 10
1 810

"Help me, Obi Wan Kenobi"?

I’ve hit the wall. I’m a one person shop who wants to start developing Cache on a mac using Eclipse/Atelier, after using Studio for the last 5 years. I’ve installed the 1.1 beta plugin, watched 6 or 7 videos from the September conference, tried several times to work through the cheat sheets, only to have connection issues or compilation issues, so at this point, I’m feeling very frustrated. The videos were interesting, but generally didn’t work as tutorials for fundamental programming operations, for me.

0 3
0 312

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 503

I am trying to import the SalesForce Enterprise WSDL in InterSystems Ensemble Studio using the SOAP Add-In. However, when I do so I receive a class dependency loop, Error #5316 during compilation. The WSDL is the standard WSDL provided with SalesForce and works fine in SoapUI. In the SalesForce WSDL it is allowed for an object A to include an object B as an element, while at the same time object B is allowed object A as an element. I think this is what causes the class dependency loop for InterSystems. Does anyone has any suggestion how I can circumvent this error?

0 7
0 720

Hi all,

I was wondering if there is any way to trigger the compilation of a class based on the compilation of another (unrelated) class. For example:

Class 1 = test.class

Class 2 = test.class.type.one

Class 3 = test.class.type.two

Every time class 2 or class 3 is compiled in Studio I would like to have class 1 automatically compiled as well.

The reason I need this is because class 1 has a method with CodeMode set to objectgenerator which generates some code based on what is found in classes 2 and 3.

0 8
0 651

Hi everyone

Is there any way to change a class definition (especifically a query definition during the compilation time)?
The idea is:
I have an abstract class with a parameter where I will define the ROWSPEC of a query and some methods to populate e temporary table
The implementation class will override the parameter, specifying the ROWSPEC of this implementation, and the methods will populate the rows in the same format as the ROWSPEC.

0 4
0 588
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 979

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

I have classes A and B, B derived from A, A has method Abc.

From INT of class B I see that compiler copies implementation of Abc to class B, so that Abc exists both in A and B.

As result, when B invokes Abs, B.Abs() is executed instead of A.Abs(). In result debuger is not able to step into Abs and breakpoints in A.Abs never hit.

Why this happens and how can I avoid this?

Update:

OK, now I know the reason: compiler makes the copy if Abc has this line:

0 21
0 395

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 305

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