#Caché

30 Followers · 4.5K Posts

  

InterSystems Caché is a multi-model DBMS and application server. See more details here.

Documentation.

Question Rustam Ibragimov · Jul 13, 2016

Hello, guys!

I want to get access to the folder where all files of the namespace are stored using COS. I found a way to get access to class files and found a folder where all csp, html, css etc files are stored.

However, is there any folder which contains all files(even .mac and .int)?  

Or, probably, there is a method which gives all files content?

2
0 468
Question Evgeny Shvarov · Jul 8, 2016

Hi!
There is interesting question in Stackoverflow.
This query works for MS SQL:

SELECT * 
FROM 
(
    SELECT *, ROW_NUMBER() OVER (PARTITION BY client_id ORDER BY date_updated DESC) AS rn
    FROM client_address
) a
WHERE a.rn = 1

There is one answer there,  which solves the task:

SELECT *
FROM 
   client_address a
   LEFT JOIN client_address b
   on a.client_id  = b.client_id 
     and a.date_updated < b.date_updated 
WHERE
   b.client_id is null

But it goes with comment, that there are no Window functions in Caché SQL.

I wonder, are there any other options to make th

5
0 2447
Question Timothy Leavitt · Jul 8, 2016

I've been trying to write a method to compare two local variables, which may be arrays, for "equality" - that is, to see if they have all the same subscripts (if they're arrays) and values. This is the best I've come up with so far - are there any better/simpler approaches out there?

/// Returns true if arrays <var>first</var> and <var>second</var> have all the same subscripts and all
/// the same values at those subscripts. <br />
/// If <var>first</var> and <var>second</var> both happen to be either undefined or unsubscripted variables,
/// returns true if they're both undefined or hav
6
0 1616
Article Mike Kadow · Jul 10, 2016 4m read

NewBie's Corner Session 12 Do and Goto

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

InterSystems Caché provides a GUI (Graphical User Interface) based Integrated Development Environment (IDE) called Caché Studio. Developers can use Studio to create and maintain applications.

Controlling Process Flow

Controlling Process Flow means controlling the execution path of code. The execution of code flows from the top to the bottom in a routine, except for the following:

•             Do and Quit commands

•             Goto command

•             Inline Do command (in a

0
0 337
Article Mark Bolinsky · Jul 1, 2016 17m read

++Update: August 2, 2018

This article provides a reference architecture as a sample for providing robust performing and highly available applications based on InterSystems Technologies that are applicable to Caché, Ensemble, HealthShare, TrakCare, and associated embedded technologies such as DeepSee, iKnow, Zen and Zen Mojo.

Azure has two different deployment models for creating and working with resources: Azure Classic and Azure Resource Manager. The information detailed in this article is based on the Azure Resource Manager model (ARM).

4
0 12627
Article Mike Kadow · Jul 7, 2016 2m read

NewBie's Corner Session 11 Routine Line Types and Gotos

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

InterSystems Caché provides a GUI (Graphical User Interface) based Integrated Development Environment (IDE) called Caché Studio. Developers can use Studio to create and maintain applications.

In this session we will cover Routine Line types; which are Label lines, Executable code lines and the Routine Header line as well as Gotos.


Routine Line types
Labels and Executable Code lines

Executable Code lines starts in column two, or many developers just hit the tab.















0
0 389
Question Paul Riker · Jul 6, 2016

I am writing a static SOAP response to simply test connectivity. The end users is getting an error "Message: The processing instruction target matching [xX][mM][lL] is not allowed.", which I believe is related to white space. if I observe the response, it looks like there are two blank lines between the header and the body, which I'm guessing is the white space problem. But I can't seem to get rid of it.

Any ideas?

Code:

<script language="Cache" method="OnPreHTTP" arguments="" returntype="%Boolean">
     Set %response.ContentType = "text/xml"
    Quit 1</script>
<?xml version="1.0" encoding

3
0 1416
Question Ondřej Hoferek · Jun 10, 2016

I need to pass an equivalent of .Net Dictionary<string, int> instance from .Net to Caché. In the application, the Caché .Net provider has been used so far, so we came up with passing it as an instance of array of data types. However, the only way to fill the array we are aware of is to use its Add() method which invokes a call to the server instance method of the array for every key-value pair inserted.

Is there any way to fill the array at once - inserting all the pairs in one server call? Alternatively, is their any other .Net (Provider or eXTreme) API we can use for this task?

I know that usi

1
0 769
Article Mike Kadow · Jun 20, 2016 4m read

NewBie's Corner Session 8 Not

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Click on the Caché Cube in your system tray and select Terminal to try out these commands.

NOT operator ('), single quote or apostrophe 

The "NOT" operator reverses the truth-value and is intended for numeric operands, however it can be used on alphanumeric operands.

Set X=1
Write  'X
0
 
Set X=1
If X Write "True"                               ; 1 is always true and 0 is always false
True
 
Set X=0
Write 'X                                                ; X is 0, so "Not X" is 1 or true
1
 
Set X=
9
0 555
Edit
Article Mike Kadow · Jul 4, 2016 2m read

NewBie's Corner Session 10, Subject: Routines and Studio

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

InterSystems Caché provides a GUI (Graphical User Interface) based Integrated Development Environment (IDE) called Caché Studio. Developers can use Studio to create and maintain applications.

InterSystems has a new IDE called Atelier but that is for later.

A Routine is the name that Caché calls computer programs. A Routine consists of a number of lines of instructions to the computer; these instructions are called code. The execution of the lines of code nor

0
0 2
Question Yongfeng Hou · Jul 1, 2016

在Aix7.1上安装使用root用户安装cache2016.1.1.107,且在安装过程中创建cacheusr用户;更改操作系统上的cacheusr的umask后,通过数据库修改编译后的文件(如,js,csp等)在小机上查看权限不变(-rwxrw-r--  cacheusr cacheusr test.js)。

目的:通过数据库编译后的文件的other用户有读写权限。

3
0 1091
Question Ryan Vanden Heuvel · Jun 20, 2016

I am trying to write this loop as efficient as possible.  The global has over 10 million records.

SET PIDX=""    
For
 { 
              Set PIDX=$ORDER(^[Nspace]LAB(PIDX))
              Quit:PIDX=""  
              Set Data=$GET(^[Nspace]LAB(PIDX))
              Set BBData=$P(Data,"\",6)
              If BBData'=""
              {
              If BBData'="########"
              {

Am I better off not setting the variable BBData and using If $P(Data,"\",6)'=""

Also, is there a better way to write the two If statements in one line so it only continues if it is either "" or ########

6
0 902
Question Nikita Savchenko · Jun 14, 2016

Hello!

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

USER>set Einstein = 1879
USER>set Mozart = 1756
USER>write
Einstein=1879
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.

Thanks!

16
0 1788
Article Dmitry Maslennikov · Jun 30, 2016 6m read

I want to show my script which I use for a completion in bash, for ccontrol and csession. 

With this script bash helps to available (running or down) instances to ccontrol, or in csession

file
/usr/share/bash-completion/completions/ccontrol

# bash completions for InterSystems ccontrol

_instances() 
{
    if [ $# == 0 ] || [ $1 == "all" ]; then
        echo $(ccontrol qlist | cut -d'^' -f1 | tr '\n' ' ')
    else 
        echo $(ccontrol qlist | grep "\^$1\," | cut -d'^' -f1 | tr '\n' ' ')
    fi
}

_ccontrol()
{
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"

    com
2
0 1023
Question Paul Riker · Jun 29, 2016

I've created a CSP page to take in a base64 value from a <textarea> and decode it. When I run it I get the error . Any ideas?

Error: <ILLEGAL VALUE>zOnPageBODY+28^csp.decode.1

ErrorNo: 5002

Here is my code

<form method="post" action="">
<table>
<tr><td><textarea rows="40" cols="200" name="submitstring"></textarea></td></tr>
<tr><td><select name="decodeoption"><option>Decode</option><option>Encode</option></select><input type="submit"/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><h2>Result</h2></td></tr>
<tr><td>
<script language=Cache runat=server>
Set tString = $Get(%request.Data("submitstring",1))
Set t

12
0 1308
Article Eduard Lebedyuk · Jun 28, 2016 1m read

Here's  a code snippet to calculate the length of a class or a package in lines of code:

ClassMethod ProjectLength(Mask As %String = "%Package%")
{
    Set count = 0
    Set sql =     "SELECT Name "_
                "FROM %Dictionary.ClassDefinition "_
                "WHERE NOT Name %STARTSWITH '%sqlcq' AND Name LIKE ? AND GeneratedBy IS NULL"
    Set rset = ##class(%SQL.Statement).%ExecDirect(, sql, Mask)
 
    While rset.%Next() {
        Set class = rset.%Get("Name")
        Do ##class(%Compiler.UDL.TextServices).GetTextAsArray(, class, .raw)
        Set lines = $ORDER(raw($CHA
3
0 584
Question Evgeny Shvarov · Jun 23, 2016

Hi!

Here is the question in Russian Forum regarding roots extracting.

In Caché ObjectScript we use exponentiation operator (**) to raise an exponent to power. F.e. let's raise 3 to power of 3: 

USER> write 3**3 

27

And we use the same operator to extract the root. 

USER> write 27**(1/3) 

2.999999999999999963

And 2.999999999999999963 is not 3, obviously.

How to extract roots properly in Caché ObjectScript?

5
0 471
Question Eduard Lebedyuk · Jun 23, 2016

I have a MySQL server with "posts" table.

I also have a Caché server with "downloadedposts" table. 

They are connected from Caché to MySQL via SQL Gateway

I want to keep Caché table synced with MySQL one  (MySQL "posts" table is a master copy), so periodically Caché queries MySQL server and downloads data. So far so good, and if a record appears or changes in MySQL table, Caché downloads the changes.

The problem I'm encountering is that sometimes rows would be deleted from  MySQL "posts" table.

How do I synchronize deletions?

4
0 1229
Article Bill McCormick · May 27, 2016 1m read

Steve Glassman is on vacation today so in his place I wanted to announce the availability of a new kit for the 2016.2 Field Test. The kit details are: 2016.2.0.665.0

There is a wide range of changes to the 2016.2 Field Test, 145 of them in total.  You can find a complete listing here:

https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/FieldTe…

Bill McCormick

Director of Product Management

4
0 476
Article Steve Glassman · Jun 24, 2016 1m read

I am pleased to announce the next 2016.2 field test kit, 2016.2.0.677.0.

I haven’t sent an update to this thread in a while and it should come as no surprise that there has been quite a lot of development going on since I wrote about build 632.  In fact, there have been almost 300 changes covering most areas of the product.

The accumulated list of fixes to problems found in the field since build 632 includes the following changes:

  • CDS2713: Access violation dump files produced
  • CDS2714: Correct I/O translation of variable length records
  • DLP3551: Dynamic Objects - refactor %ToAbstractObject and relate
0
0 401
Question David Losiewicz · Jun 23, 2016

I am testing application code and want to simulate error conditions. 

I am trying to use the following to define a custom error with a class method.

$SYSTEM.Status.Error($$$GeneralError,"Any text here")

My class method code looks like this....

set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")

Class compile fails because the $$$GeneralError is unknown. 

ERROR: DBMS.Reports.TaskPage.1(5) : MPP5610 : Referenced macro not defined: 'GeneralError'
 TEXT: set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")
 

I expect I need to include something

5
0 1506