Caché

This post is intended to guide you through the new JSON capabilities that we introduced in Caché 2016.1. JSON has emerged to a serialization format used in many places. The web started it, but nowadays it is utilized everywhere. We've got plenty to cover, so let's get started.

Last comment 11 January 2019
+ 32   1 32
7593

views

+ 32

rating

Hi Community!

Coding guidelines discussion. Consider you have For with one command in the cycle. Here are the options:

One

For i=1:1:1000 set ^Test(i)=""

Two

For i=1:1:1000 {
 set ^Test(i)=""
}

Same for the "If":

if a set b=a

or

if a {
 set b=a
}

Your choice? Or maybe even other options? 

Last comment 23 October 2019
+ 2   1 17
1067

views

+ 2

rating

Hi, Community!

Have a question for general discussion. 

In ObjectScript we have cls for classes and mac code, which both compile into int code. 

Is there any reason when you use mac instead of cls  for non-persistent classes?

For me the benefits for cls are:

1. Inheritance and other OOP features

2. Auto-documented code 

For mac one visible benefit is easier call in terminal:

do method^Utils(p1,p2)

vs

Last comment 18 July 2018
0   1 15
1705

views

0

rating

Cogs Library

Over the next few months I will be releasing a number of open source libraries and tools to the Caché community.

Most of the code has evolved from previous production grade solutions over the years and I am collating it together under a single overarching library package that I am calling Cogs.

Last comment 3 August 2019
+ 17   4 8
1009

views

+ 17

rating

I have a simple app which tries to establish a connection with a Cache database instance via Global API for Java:

import com.intersys.globals.Connection;
import com.intersys.globals.ConnectionContext;

public class Assignment {

    public static void main(String[] args) {
        Connection connection = ConnectionContext.getConnection();
        connection.connect("SAMPLES", "_SYSTEM", "SYS");
    }

}

The expection I am getting:

Last answer 27 February 2018 Last comment 25 March 2018
0   0 4
492

views

0

rating

The newer dynamic SQL classes (%SQL.Statement and %StatementResult) perform better than %ResultSet, but I did not adopt them for some time because I had learned how to use %ResultSet. Finally, I made a cheat sheet, which I find useful when writing new code or rewriting old code. I thought other people might find it useful.

First, here is a somewhat more verbose adaptation of my cheat sheet:

Last comment 15 August 2019
+ 7   2 13
1498

views

+ 7

rating

Hello Everyone,

I'm want to know, what is more common for your company to use, the abbreviation syntax or the complety name of commands, and why?

Ex. 

S VAR=10 / D FUNC^ROUTINE F 1:1:1000

Set VAR=10 / Do Func^Routine / For 1:1:1000

set var=10 / do func^routine / for 1:1:1000

Here in my company, we are familiar with the abbreviation syntax, because to spell is more faster.

Last answer 29 October 2019 Last comment 20 November 2019
+ 2   0 11
456

views

+ 2

rating


Hello!

This article is a small overview of a tool that helps to understand classes and their structure inside the InterSystems products: from IRIS to Caché, Ensemble, HealthShare.

In short, it visualizes a class or an entire package, shows the relations between classes and provides all the possible information to developers and team leads without making them go to Studio and examine the code there.

If you are learning InterSystems products, reviewing projects a lot or just interested in something new in InterSystems Technology solutions — you are more than welcome to read the overview of ObjectScript Class Explorer!

Last comment 19 July 2019
+ 17   2 12
3615

views

+ 17

rating

SOLVED

tl;dr how can you tell if a number is really a string

The original question has been updated/improved.

Equality comparisons on floating point numbers will produce different results...

"1.1"=1.1  //is true!

"0.1"=0.1  //is not true :(

This second comparison can be fixed with...

+"0.1"=+0.1 // is true!

Last answer 31 August 2017 Last comment 1 September 2017
0   0 2
657

views

0

rating

The DeclarativeCOS project is a heartfelt cry about programming in the COS language.

The purpose of the project is to draw attention of the public to improving the inner core of COS.

The idea of the project is the support of a laconic syntax for cycles and collections.

So what is this laconic something that I have come up with? Welcome to the examples below!

Examples

The key concept underlying the project is the declarative approach to writing code. You need to specify WHAT should be used and HOW.

Last comment 3 September 2019
+ 6   0 7
1268

views

+ 6

rating

Greetings, InterSystems community!

I am pleased to announce that the web terminal project, Caché WebTerminal version 4 gets its release! After long period of enhancing this web application from 2013, it came to the version 4, which features major stability and security improvements, intelligent autocomplete and syntax highlighting, convenient SQL mode and a lot of other useful features.

The goal of this article is to spread the knowledge about this project over the InterSystems community.

Last comment 26 February 2019
+ 15   2 8
2068

views

+ 15

rating

I am trying to fetch the data from cache database. But i got the error like "CSP application closed the connection before sending a responce".

Below is the query.

SELECT
CallbackComment
FROM SQ.CBPhoneResult_View Where PhoneDateODBC = '2018-04-09'

I have investigated and found that "CallbackComment" contains the special character single quotes " ' "  for one result and due to this i got this error.

In this field data is enter by customer. so we cannot restrict them like Do Not use single quotes.

Last answer 7 July 2018 Last comment 9 July 2018
0   0 2
556

views

0

rating

I would like to start a discussion regarding Caché Objects and Caché SQL.

It is my understanding that the creators of Caché Objects see Caché SQL as the reporting arm of Objects and as such SQL is essential to Caché Objects.

I once met a Caché Objects programmer who was writing code to $Order through the Globals because that person thought that Caché SQL was too slow and inefficient. I attempted to convince the person otherwise.

So, what say you? Is SQL essential to Caché Objects?

Or

Last answer 13 June 2017 Last comment 28 June 2017
0   0 11
593

views

0

rating

I have a query string that I am creating programmatically, based on some user inputs.  The user might search on 5 fields, or 8 fields, or no fields.

In my sql statment, some of these fields require parameters in the %Execute statement.

 

For example:

if user picks lastname, sql = "select * from person where lastname = ?"

if user also picks age, sql = "select * from person where lastname=? and age > ?"

 

I then have these lines of code to create my result set:

set statement = %SQL.Statement

statement.%Prepare

Last answer 18 July 2017 Last comment 20 July 2017
0   0 3
8767

views

0

rating

Intro

 

Please note, this article is considered deprecated, check out the new revision over here: https://community.intersystems.com/post/tutorial-websockets

The goal of this post is to discuss working with Websockets in a Caché environment. We are going to have a quick discussion of what websockets are and then talk through an example chat application implemented on top of Websockets.

Last comment 28 January 2019
+ 12   4 18
8110

views

+ 12

rating

Hi Community!

Sometimes I meet a method which accepts 10+ parameters.

And often I need only the 8th parameter  to  pass. And I call the method something like:

do ##class(Some.Feature).Method(,,,,,,,"flag")

And I don't like this method when I call it like this cause, you know, often I just miss the number of commas and raise some other flag I wanted.

How do you avoid this situations? 

If you meet such a code, how do you call it and sure that you didn't miss the number of ","?

What is a good number of parameters in a method and f you need to pass more parameters in a method what do you do?

Last answer 5 May 2019 Last comment 27 August 2019
+ 3   1 12
547

views

+ 3

rating

The dataCombo property columnHeaders is a comma-delimited list of column headers displayed in the dropdown list.

Comma is a delimiter.

But, if I want add comma to columh header, for instance "House number, apartment" - this is value for header of one column.

How can I escape comma in this case?

"House number\, apartment" - is not working. 

Last answer 22 August 2017 Last comment 24 August 2017
0   0 6
300

views

0

rating

Hi, folks!

Suppose you have a Caché class with %String property which contains relatively large text (from 10 to 2000 symbols).

The class:

Class Test.Duplicates Extends %Persistent 

{

Property Text As %String (MAXLEN = 2000);

}

And you have thousands of entries.

What are the best options to find entries which are duplicates on this property?

Last answer 1 December 2017 Last comment 9 November 2017
0   1 2
705

views

0

rating

Currently, when we want to write data to a file that will be viewed in Excel, we parse the data in tab deliminated format to the file and name it with .xls at the end.  That is sent to end users via email.  They get a warning that the data is not formatted properly (it's not really an Excel file after all) but it does display somewhat correctly as the tabs are understood (this does not work if we deliminated with commas however).

Last answer 1 May 2019 Last comment 4 June 2019
+ 3   3 12
962

views

+ 3

rating

I'm aware of two ways to get list of files in a dir:

set dir = "C:\temp\"
set rs = ##class(%File).FileSetFunc(dir, , , 1)
do rs.%Display()

and:

set dir = "C:\temp\"
set file=$ZSEARCH(dir_"*")
while file'="" {
   write !,file
   set file=$ZSEARCH("")
}

Yet they bot return only files and directories in a current directory, but not files in subdirectories.

I suppose I call one of these recursively, but maybe there's a better solution?

Last answer 1 June 2017 Last comment 27 May 2017
+ 1   1 7
1449

views

+ 1

rating

I am working with a client to try and export a set of tasks defined in the Task Manager from one system to another.  I am not seeing any API for this.  I can query this information in SQL.  So I tried to use the Data Export Wizard from the System Management portal in the SQL window.  Export was fine.  Importing failed with a "can't insert into read only field" error.  Looking at the class definition does not help since the implementation details are not visible.

So how would one accomplish this?  Export scheduled tasks from one system to another?

Last answer 2 June 2018 Last comment 4 June 2018
0   0 5
472

views

0

rating

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.

Last comment 18 April 2017
+ 4   0 1
773

views

+ 4

rating

A few people wrote to me asking about the infrastructure behind the Atelier Server implementation. Its neat and a worthwhile story to share so I am writing it up here as a post on the community. I want to go in to a little detail on why it was needed and then I will outline in detail how we went about implementing this.

Last comment 12 October 2016
+ 10   0 0
887

views

+ 10

rating

This is the second part of my long post about package managers in operating systems and language distributions. Now, hopefully, we have managed to convince you that convenient package manager and rich 3rd party code repository is one key factor in establishing of a vibrant and fast growing ecosystem. (Another possible reason for ecosystem success is the consistent language design, but it will be topic for another day.)
Last comment 6 February 2017
+ 6   0 0
1005

views

+ 6

rating

In this article I would like to present the RESTForms project - generic REST API backend for modern web applications.

The idea behind the project is simple -after I wrote several REST APIs I realized that generally, REST API consists of two parts:

  • Work with persistent classes
  • Custom business logic

And, while you'll have to write your own custom business logic, RESTForms provides all things related to working with persistent classes right out of the box.
Use cases

  • You already have a data model in Caché and you want to expose some (or all) of the information in a form of REST API
  • You are developing a new Caché application and you want to provide a REST API
Last comment 17 May 2018
+ 12   3 7
3451

views

+ 12

rating