#Caché

30 Followers · 4.5K Posts

  

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

Documentation.

Question Sean Connelly · Aug 25, 2017

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!

The problem is, what if we don't realise that a value is a stringy number, or just overlook implementing this defensive check.

One solution would be to lint check %Float properties and return types that should originate from a number and not a string, as discussed here...

31
0 1307
Question Mihai Radu · Aug 31, 2017

I am trying to capture the write of a method to test the response in an unit test. I know everything works because one of my colleagues ran the code and did not froze on his machine.

I don't what is the cause of the freeze. I know that at line Use $io::("^"_$ZNAME) it stopes because i have put some write functions after every line in WriteCapture method and i only saw the first write function in terminal

I also used debug and in this case it didn't froze

PS: forgot to put the status in the XECUTE (vstrCommand, .status)

This is my method that captures the write:

7
0 604
Question Russell Knight · Aug 31, 2017

Greetings,

Is it possible to save Cache code into a file and then run it via command line?  

IE:  csession [ini] -U [ini] /path/cacheCodeFile.?

What I need to do is run a Cache script from the Linux command line.  The script will navigate data to produce a file and then it will exit back to the command line.

Thanks in advance for everyone's time.

2
0 3729
Question Eduard Lebedyuk · Aug 31, 2017

I need to check if one class is a subclass of another (either direct or indirect).

For example:

Class Package.ClassA Extends %Library.Persistent
{
}

Class Package.ClassB Extends Package.ClassA 
{
}

Class Package.ClassC Extends Package.ClassB
{
}

In this example Package.ClassC is a subclass of 3 classes: %Library.Persistent, Package.ClassA, Package.ClassB.

So any of these checks should return 1:

3
0 949
Question Razvan Prepelita · Aug 30, 2017

Hello, I've completed this tutorial: https://community.intersystems.com/post/deepsee-period-date-vs-same-per…
I've used the "year" level instead of a pivot variable.
I want to calculate something like the following variation: 100 * ([DateOfSale].[PTD] - [DateOfSale].[LYPTD]) / [DateOfSale].[LYPTD]
I create a new calculated member, under the same dimmension with the above expression.
I put the new calculated member under the Count measure and it tells me that "Two measures cannot be crossjoined"
What am I doing wrong?
Can you redirect me to some explanations and maybe a solution?
Thanks!

3
0 447
Question Eduard Lebedyuk · Aug 31, 2017

I need to get a list of all classes that are subclasses of two unrelated classes.

For example I want to get a list of all classes that are both:

  • Persistent (extends %Library.Persistent)
  • XML-Enabled (extends %XML.Adaptor)

To get subclasses of one class I can use this query:

set rs = ##class(%Dictionary.ClassDefinitionQuery).SubclassOfFunc("%Library.Persistent")

But what about two classes?

I suppose I can run this query twice, build two $lb, then iterate over one of them and build a new $lb with classes that appear in both lists. Are there any better approaches?

6
0 737
Question Amir Samary · Sep 21, 2016

Hi!

I am not system admin. But it used to be very simple to install CSP Gateway on an apache system on Linux with Apache installed. I used to run the CSP Gateway installation program and after it was done, all I had to do was fine tune some configurations on CSP Gateway portal on http://<ip>/csp/bin/Systems/Module.cxw and I was up and running.

5
0 1528
Question Craig Regester · Aug 30, 2017

Good afternoon - 

I'm in the process of learning to make COS calls to REST-based web services and while I am having success, I'm struggling on how to parse out the results (I admit I'm very green at this):

Here's the code retrieving the JSON response:

w !,"Get the JSON"Set Result = {}.%FromJSON(Request.HttpResponse.Data)

This has Result as a Library.DynamicObject.

I can then write out the response using:

w !,Result.%ToJSON()

This works, I can see the response is valid and what I want. Here is the JSON returned (de-identified):
 

4
1 1413
Question Rui Figueiredo · Aug 25, 2017

I'm working on an existing Zen Report that uses queryClass/queryName to retrieve data using a class that has a Stored Procedure method. Which works fine.
I have created second class with a Stored Procedure method, I modified the zen report to use this class and now I'm having the following error.

Error: SQLCODE: -99 Message: User UnknownUser is not privileged for the operation
ErrorNo: 5540

 

Regards,

Rui

4
0 510
Question Alexey Maslov · Aug 17, 2017

Hello everybody.

What I have is a criteria how to select "my" strings. What I need is to replace all of them with macro calls (using the same strings as arguments) in all classes of current namespace.

I was ready to write straightforward code, but at the last moment decided to ask the community: maybe I've overlooked a smarter option?

Any comments and advices would be great appreciated.

6
0 616
Question William Vorhees · Aug 4, 2017

Trying to use AES encryption for a url.  I have a plain text string, a 16-byte key and a initialization vector.  I am trying to match a C# implementation that uses RijndaelManaged class with a  BlockSize = 128, Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7.  The output of the $SYSTEM.Encryption.AESCBCEncrypt(text,key,IV), doesn't match what is coming out of C#.  All inputs into the $SYSTEM.Encryption.AESCBCEncrypt(text,key,IV) are converted to UTF8 as in the documentation.

5
0 1858
Question Lewis Greitzer · Aug 28, 2017

Hi folks, I'm trying to pad my patient MRN to 10 characters before I do a SQL lookup in my BPL. I've tried various approaches, and have not been successful.

When I add a "code" statement with the following code, I get an error as below.

set context.NewID = "0000000000"
set $EXTRACT(context.NewID,10-len(context.PatientID)) = context.PatientID
9
0 1067
Question Sergey Pavlov · Aug 25, 2017

Is there a way to omit or skip rollback of some data changes during a transaction rollback? Maybe some sort of "autonomous transaction"?

The issue is with error logging in transaction. For example we may have in nested calls the following structure:
TS
<some code>
<error happens>
TRO 1
<error log to database>

but if this code is in another transaction, and that rolls back we lose error data.

Is there a way to do something like
TS
<some code>
<error happens>
TRO 1

<autonomous transaction start\flag>
<error log to database>

<autonomous transaction finish\flag>

7
0 1043
Question Evgeny Shvarov · Aug 28, 2017

Hi, folks!

I'm sending emails with %Net.MailMessage.

How can I add a new line for the email body?

The code is:

dim msg as %Net.MailMessage = ##class(%Net.MailMessage).%New()
set msg.Charset="UTF-8"
do msg.TextData.Write("Dear  "_Username)
do msg.TextData.Write("Line1")
do msg.TextData.Write("Line2")
And I'm getting in email:
Dear UserLine1Line2

How can I get:

Dear User

Line1

Line2
8
1 1883
Question CM Wang · Aug 18, 2017

I want to manipulate all the objects whose type is%Dictionary.StorageSQLMapDefinition by %OpenId

However, I don't know the exact id to feed into %OpenId, is there a way to query all the existing ids of %Dictionary.StorageSQLMapDefinition in a namespace?

Thanks.

3
0 449
Question Ruslan K · Aug 22, 2017

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. 

26
0 646
Question Uri Shmueli · Aug 22, 2017

Hi

Does anybody know what happend to %SYS.GSET routine in Cache 2016 ?

In Cache 2013 it still existed, I didn't find anything about it in Cache realese notes 2014 and 2015.

Uri

10
0 486
Article Sean Connelly · Aug 21, 2017 2m read

tl;dr I have discovered that using $THIS in a very specific way will make persistent objects go stale.

I found that it only happens when using $get on an array that contains the OID reference of $THIS. I assume that this is an unwanted feature and have raised a WRC. The problem can be recreated following the steps below, I have also posted the workaround that I am currently testing and looks to be working fine.

1. Create a persistent class...

7
0 459
Question Kurro Lopez · Aug 23, 2017

Hi all,

I need to create a routine to modifiy some values in a global.

My first attempt was:

    // Search the first position of Messages
    set pos=$Order(^Ens.MessageBodyD(""))
    while(pos > 0){
        // Get the class name
        set clase = $Order(^Ens.MessageBodyD(pos,1))
        if (clase="MensajesRestResponse")
        {
            // Do the convertion
        }
        set pos = $Next(^Ens.MessageBodyD(pos))
    }

but if I use a *.bas file (cache basic script), I'm not able to use these commands ($Order and $Next) and I don't know how to translate theses words.

3
0 568
Article Robert Cemper · Aug 23, 2017 2m read

I worked through the Community for proposals to provide end users
in an easy way with data formatted as EXCEL sheet.

There is a great article Tips & Tricks - SQL to Excel

there's an important message embedded: "EXCEL can interpret HTML tables and display them as usual"

Where's the light weight export to EXCEL ?
Good old CSP is well equipped to produce HTML tables accepted from EXCEL as input.
With modern Browsers you don't even need <head>and  <body> tags.
So the required code around your SQL result set is really slim.
And you are free to add any formatting you need either by HTML or in SQL.

1
1 1727
Article Murray Oldfield · Apr 8, 2016 17m read

This post will guide you through the process of sizing shared memory requirements for database applications running on InterSystems data platforms. It will cover key aspects such as global and routine buffers, gmheap, and locksize, providing you with a comprehensive understanding. Additionally, it will offer performance tips for configuring servers and virtualizing IRIS applications. Please note that when I refer to IRIS, I include all the data platforms (Ensemble, HealthShare, iKnow, Caché, and IRIS).

3
9 11218
Question Alexey Maslov · Aug 21, 2017

Hello everybody,

We have a piece of Caché software which calls an external utility using $zf(-1,command). It works fine under Linux, but under Windows an external process occasionally hangs (due to some internal problems out of the scope here) and need to be killed programmatically. Having PID, it's easy to kill a process. If a Caché process is called with JOB command, the caller can easily get its PID from $zchild, but alas $zf(-1) does not seem to return the similar info. Is it possible to get it somehow?

4
0 784
Article Fabian Haupt · Jan 20, 2017 8m read

This is the first article of a series diving into visualization tools and analysis of time series data. Obviously we are most interested in looking at performance related data we can gather from the Caché family of products. However, as we'll see down the road, we are absolutely not limited to that. For now we are exploring python and the libraries/tools available within that ecosystem.

The series is closely tying into Murray's excellent series about Caché performance and monitoring (see here) and more specifically this article.

4
1 1806
Question Coty Embry · Aug 19, 2017

I was wondering if there was a way to if the user is using Studio and changes a file to get the users name and have a function run when the file is changed. 

Ive got this working for .int files but not for .csp or .js or .css or any other kinds of files. 

When we edit code we are logged in to the Cache backend’s server through Studio by using an iPaddress (which is on our network). 

I know now there are concepts of file locks and logs for when certain tasks are ran or when a user maybe edits a file

5
0 460
InterSystems Official Andreas Dieckow · Aug 21, 2017
Project related quality assurance efforts have revealed a number of concerns for the current release of 2017.1.0 and 2017.1.1 on all OpenVMS platforms. In certain situations, the impact can be severe. InterSystems will address these issues with the upcoming 2017.1.2 release, and in the meantime, will remove all 2017.1.x kits for OpenVMS from our Download Servers.
 
If you have immediate needs correcting existing deployments of this version, please contact the InterSystems WRC (support@intersystems.com).
 
0
0 742