#Caché

1 Follower · 4.5K Posts

  

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

Documentation.

Question Roberto Cahanap · Aug 16, 2018

I need to start doing unit testing for some of my code.

Why does it delete the unit testing class from Cache when I run the test?

Is there a way to turn this off?

20
0 726
Article Ponnumani Gurusamy · Mar 11, 2019 1m read
Class User.samplexlsconversion Extends (%Persistent, %Populate) [ Owner = {_PUBLIC} ]{
Property name As %String;
Property DOB As %Date;
Property address As %String;
Property PhoneNumber As %Numeric;
Property BloodGroup As %String(DISPLAYLIST = "", VALUELIST = "A A- B B- O");
ClassMethod ExtractXls()
{
               Set file=##class(%Library.File).%New("C:\Users\Ponnumani\Desktop\Ponnumani Tasks\file.csv")
               Do file.Open("WSN")
               Do file.WriteLine("""Name"",""Address"",""Phone Number"",""Blood Group"",""Date""")
               s id=""
               f {
4
1 900
Article Murray Oldfield · Mar 15, 2018 14m read

InterSystems Data Platform includes utilities and tools for system monitoring and alerting, however System Administrators new to solutions built on the InterSystems Data Platform (a.k.a Caché) need to know where to start and what to configure.

This guide shows the path to a minimum monitoring and alerting solution using references from online documentation and developer community posts to show you how to enable and configure the following;

  1. Caché Monitor: Scans the console log and sends emails alerts.

  2. System Monitor: Monitors system status and resources, generating notifications (alerts and warnings) based on fixed parameters and also tracks overall system health.

  3. Health Monitor: Samples key system and user-defined metrics and compares them to user-configurable parameters and established normal values, generating notifications when samples exceed applicable or learned thresholds.

  4. History Monitor: Maintains a historical database of performance and system usage metrics.

  5. pButtons: Operating system and Caché metrics collection scheduled daily.

Remember this guide is a minimum configuration, the included tools are flexible and extensible so more functionality is available when needed. This guide skips through the documentation to get you up and going. You will need to dive deeper into the documentation to get the most out of the monitoring tools, in the meantime, think of this as a set of cheat sheets to get up and running.

1
8 2382
Question Virat Sharma · Mar 9, 2019

Hi Community,

I have to make a daily task (Job) which will run (7 am to 7 pm) in a day at an interval of 3 hours. Timings are as (7:00 am, 10:00 am,13:00 pm,16:00 pm,19:00 pm). But at each time when task will run i have to set a variables as per below condition

Sample:

1) If task run at 2019-03-19 07:00 am in morning

I  have to set two variables (start and end) whose value will become like this

(set starttime= 2019-03-09 07:00:00.00 and set endtime=2019-03-09 10:00:00.00)

2) But if task run at 2019-03-19 10:00 am in morning, the value should change as per below

3
0 375
Question Jose Antonio Cañizares · Mar 5, 2019

Hi all,

Lets imagine that there's a process that locks an entry of a gived domain, in my example the ID 2 of the table User.tApplications and using an exclusive lock.  Additionally the error handling is managed by a $ETrap routine wich will look for error data in order to log it

Set $ETrap = "Do Err1^ErrRoutine"

Set obj = ##class(User.tApplications).%OpenId(2,"4",.errors)

If ($System.Status.IsError(errors){// Error: ERR_PESSIMISTIC_LOCK   Set $ECode = <MyerrorCode>}

When a  second process try to do the same action will cause an error informing that there's a lock (that is ok)

1
0 378
Question Marco den Hartog · Mar 6, 2019

Hi community,

I have a rights problem when giving a user permission to perform some select queries on particular tables. So I have created a user with the following rights.

So this all works well. No problem so far. But the customer is using a program where you can easily build visually the query by selecting the table, choose the right colums etc. So the problem we have is when I give the user the Role %All the tables are shown.

6
0 661
Question David Morgenstern · Mar 5, 2019

I have a cache client trying to call a web service using  SOAP version 1.2.  We receive a SOAP error with the following text:

COD>w ##class(DBMS.Tools).DecomposeError(%objlasterror)

ERROR #6248: SOAP response is a SOAP fault: <Fault><Code><Value>s:Sender</Value>

<Subcode><Value>a:ActionMismatch</Value></Subcode></Code><Reason><Text xml:lang=

"en-US">The SOAP action specified on the message, '', does not match the HTTP SO

AP Action, 'siad.tpic/ITpicDefaultService/Audit'. </Text></Reason><Detail><a:Pro

blemHeaderQName>a:Action</a:ProblemHeaderQName></Detail></Fault>

3
0 2216
Discussion Evgeny Shvarov · Mar 7, 2019

Hi Community!

There are two general ways to execute arbitrary SQL  in serverside ObjectScript code: EmbeddedSQL and ObjectScript SQL a.k.a. Dynamic SQL.

E.g. if we want to get the value of the property of instance with a certain ID using SQL we can do:

&sql(SELECT Name INTO :name FROM Sample.Person WHERE ID=1)

write name

Same result with %SQL.Statement:

set rs=##class(%SQL.Statement).%ExecDirect(,"SELECT Name as name FROM Sample.Person where ID=1")
  do rs.%Next()
  write rs.name
2
0 1081
Question Dmitry Maslennikov · Mar 6, 2019

Let's imagine you have only SQL. You need some table where you should increment value in some property when you update this line.

We have the table

CREATE TABLE "test" (
  "identifier"   VARCHAR(200) NOT NULL,
  "value"        INTEGER,
  PRIMARY KEY ("identifier")
)
6
0 804
Question Kumaresan Ramakrishnan · Jan 25, 2019

Hi, 

what is reason of this error (Not all parameters bound/registered ). this is not happening consistently.

those are class method parameters

Query GetWorkItemsByEncounterID(encounterID As %Integer, userId As %Integer, IsSuperOrDev As %Integer = -1, facilityAccessListCSV As %String(MAXLEN=32000), locationAccessListCSV As %Library.String(MAXLEN=32000), skipReferralFilter = 0) As %SQLQuery [ SqlName = spGetWorkItemsByEncounterID, SqlProc ]
 

1
0 736
Question Gunwant Kapade · Mar 5, 2019

After compilation of routine .int file is not generated and toggle breakpoint is also not visible for that routine. It is showing error #5001 Editing of INT file is not allowed. How can I resolve this ?

2
0 373
Question Neerav Verma · Mar 5, 2019

Just wondering an Insight in the difference between these two indexes

IdKey / PrimaryKey
================= 

Property Identifier As %Integer

Index Index1 on Identifier [Idkey]

Index Index2 on Identifier [PrimaryKey]

What's the difference?

1. If I don't have Index1 and only have Index2,  then cache does still make its own id.
So how and why  do I ever use the PrimaryKey.  In Joins ??

Table1.Identifier = Table2.Identifier instead of Table1.Id = Table2.id ??
But I can still use Table1.Id = Table2.Id as cache still made one ID field

So where is PrimaryKey useful in cache?

4
0 1191
Question Neerav Verma · Mar 2, 2019

Hi

Just curious to know about the pros and cons of Parent/Child Vs One/Many.

We do use a bit of both. 
One big reason we use Parent child is we feel if we delete one global, it gets rid of all child data too and all parent child data is stored in one global. Much easier to manage.

4
0 896
Article Stuart Byrne · Mar 2, 2019 6m read

I know it's late, but I really love the advent of code theme each year to find some project ideas to go out and code something and push myself.

I had the intentions of completing the AOC 2018 before the new year, but I've got 2 young kids (1yo and 4yo), so most nights I just want to sleep.

I've been looking at this on my half hourly commute each day before and after work.

So whilst doing this, I found not many people had posted what they had done and in previous years.

2
0 270
Question Eduard Lebedyuk · Mar 2, 2019

I have one abstract class and several subclasses. All share one data/id global.

How can I get concrete class name from id (without opening the object)?

What I have so far:

write $p($lg(^DATAGLOBAL(<id>),1),"~",*-1)

It does the job, but is there a more official way?

3
0 326
Question Eduard Lebedyuk · Feb 28, 2019

Here's a simple indirection snippet. It fails with <UNDEFINED> error and I'm not sure why.

ClassMethod ind()
{
  kill info

  set active = 1
  set reactive = 2

  for i="active","reactive" {
    set info(i)= @i
  }

  zw info

  break
}

 

I'm getting this exception: <UNDEFINED>zind+5^test.Client.1 *active

6
0 583
Article Eduard Lebedyuk · Mar 7, 2018 7m read

In this series of articles, I'd like to present and discuss several possible approaches toward software development with InterSystems technologies and GitLab. I will cover such topics as:

  • Git 101
  • Git flow (development process)
  • GitLab installation
  • GitLab Workflow
  • Continuous Delivery
  • GitLab installation and configuration
  • GitLab CI/CD
1
3 3394
Question Eduard Lebedyuk · Feb 28, 2019

I'm connecting to a remote device using TCP. It has a binary protocol.

set host = ""
set port = ""
set io = $io
set device = "|TCP|7000"

set timeout = 2
open device:(host:port:"M")
use device:(/IOT="RAW")
read string:timeout

use io
zzdump string

The problem is when reading from it, I get a 0A (also known as 10 or \n or linefeed) byte, which terminates the read.

Expected output:

0000: 42 00 7B 0A 11

But I get this output:

0000: 42 00 7B

How can I fix that?

Some additional info:

  • read completes in 0.1 seconds despite 2 seconds timeout.
  • $zb contains the value of 0D
1
0 293
Question William Beetge · Feb 28, 2019

I have an existing table, and I've added an array property to it that I need to populate.
The issue is that I can only use SQL to insert into the table due to access reasons.

For example:

Class Package.Tables.Person Extends %Persistent
{
Property Name As %String(MAXLEN = "");

Property Address As Array of Package.Datatypes.Address;
}

Class Package.Datatypes.Address Extends %SerialObject
{
    Property AddressType As %Integer;
    Property StreetAddress As %String(MAXLKEN = "");
}
                
So the projected tables are:

Package_Tables.Person
Package_Tables.Person_Address

1
0 515
Question Daniel Lee · Feb 21, 2019

I am taking over a production system that had some HSLIB and other database routine and class files modified. However, I do not know what was modified .

I developed a routine that allows me to load each database in our production instance and compare it against a default instance using the SIZE attribute. This allowed me to generate a list of files where the .INT file size in production does not match the file size in the default instance. However, doing a spot check of the .cls or .mac files indicates that in some cases these files are identical, just the intermediate files are different. 

9
0 1288
Question Javier Llobet · Feb 26, 2019

I try to create a column with computeonchange. 

Its works with CREATE TABLE sql command, but if i use ALTER TABLE ADD COLUMN sql command this computeonchange doesn't works.

any reason why?

example:

CREATE TABLE MyStudents (   Name VARCHAR(16) NOT NULL,   surname VARCHAR(16))

alter table MyStudents add column fullname Varchar(50) COMPUTECODE { SET {fullname}={Name}_ "?" _{surname}} COMPUTEONCHANGE (Name,surname)  

insert into SQLUser.MyStudents (Name, surname) values ('name1',null)

update MyStudents set name = 'name' where name = 'name1'

this not updates fullname column value....

1
0 256
Question Nael Nasereldeen · Jan 1, 2019

Hi,

When Creating a custom security role, what privileges do I need to add to it, in order for the users that I grant him the role, to be able to use 

dynamic SQL to perform read only queries on all tables in a namespace?

I have a security role, that contains the %Service_SQL privilege,

And yet when I connect to a terminal and try to run an SQL query using dynamic SQL , I get a "user is not privileged for the operation" error.

reading the documentation , I understand that %Service_SQL privilege privilege is not enough, but I don't understand what privilege to add,

7
0 1606
Question Stella Ticker · Feb 21, 2019

I am reviewing some code where the % sign has been used liberally to name arrays that are worked on by different methods within the same class. Apparently it is not good practice to name variables with a "%" sign as the first character because this could overwrite other similarly named variables from other developers, including ISC!  Is there another way to make a variable public ? 

8
0 743
Question Arto Alatalo · Feb 21, 2019

I'm getting this compilation error:

Kompilieren der Klasse digi.packet
FEHLER #5002: Caché-Fehler: <FUNCTION>zLockUse+5^%ExtentMgr.GlobalRegistry.1
  > FEHLER #5030: Während der Kompilierung von Klasse 'digi.packet' ist ein Fehler aufgetreten

when importing one of my classes on the production server into one particular namespace:

8
0 798