#Caché

1 Follower · 4.5K Posts

  

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

Documentation.

Question Richard Roeder · Sep 6, 2017

Hi,

I'm developing an integration between Caché servers by ODBC conection, and I have the following problem.

In this call:

call COSClass_Methode('222169^^98^155^64530^06:30^021542987897458855441112877855^1^0^281992^GC')

the ODBC driver is truncating the string to 50 characters.


If I run this same command with $system.SQL.Shell(), this doesn't occur.
I did a test creating several parameters for COSClass_Methode, and they all have a 50 character limitation.

Does anyone know why the ODBC Cache Driver limits the number of characters per parameter of this type of call?
Or, how can I adjust this?

4
1 1722
Article Sean Connelly · Apr 27, 2017 7m read

XDATA is used for a whole host of ISC libraries to store things like Zen pages, BPL logic and DTL transformations.

XDATA is the equivalent of XML config files of the JAVA world and JSON config files of the JavaScript / NPM world.

Whilst Atelier looks to shift source code to the disk, XDATA will remain a key component to source control our projects config / meta data.

I come across many developers who overlook XDATA, seeing it as an internal function of Cache and Ensemble and instead use globals to move meta data around, I've been there myself.

4
0 1315
Question Paul Riker · Sep 5, 2017

Is it possible to execute a sql update statement from objectscript? This code isn't working for me.

Set tSQL = "UPDATE table Set Status = 'Completed' WHERE ID in (1,2,3,4)"
Set tStatement = ##class(%SQL.Statement).%New()
Set tSC = tStatement.%Prepare(tSQL)

If I write my dynamic sql to the event log, copy and execute it in the Management Portal, it works fine.

4
0 963
Article Ben Spead · Feb 25, 2016 1m read

I wanted to share a little tidbit which is in the Studio documentation (http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls…) but many people who have been using the InterSystems Studio for a long time missed the addition of this *very* useful feature, and every time I mention this to an audience  I see at least one face light up because of how excited they are to learn about it!

7
0 1613
Question Nael Nasereldeen · Aug 31, 2017

Hi guys,

How do you deal with underscore characters when using jsonProvider  and exporting or importing ?

for example:

USER>s jsonString="{""what"":""1"",""up"":""2"",""test_test"":""3""}"
 
USER>set status = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(jsonString,,.outputObj)
 
USER>w outputObj.what
1
USER>w outputObj.up
2
USER>w outputObj.test_test
 
W outputObj.test_test
^
<UNDEFINED> *test

we found out that we can access it like this, but not sure if it's the recommended method-

w outputObj.%data("test_test")

Regards,

Nael

11
0 641
Question Kevin Furze · Sep 5, 2017

version 2016.2.1 on windows

I accidently clicked the mouse into the output window of studio (where you get the compile results etc) and typed soemthing in there (by mistake) and it came back with <SYNTAX>.

I've been playing with it further, and it's like a cut down version of terminal.

I can "s x=1" and the "w x" and sure enough, it will display "1" (ie the value of x)

when I call one of my utilities ie "d ^dev", my utility runs as expected, but when I try entering a value (my utility was waiting on a read *x) it generated a <SYNTAX> error.

7
0 617
Article Rob Tweed · Jul 31, 2017 5m read

In my previous posting about the new support in QEWD for JSON Web Token (JWT) support, I mentioned that it was a key step in enabling Micro-Service support in QEWD.  In this post I'll give some background to how they work and the thinking behind them.

If you haven't heard about Micro-Services and/or want to learn more, there's lots of information available if you do a Google Search.  Here's a good starting point:

https://smartbear.com/learn/api-design/what-are-microservices/

3
0 817
Question Rubens Silva · Sep 4, 2017

Hello, I just noticed that the following query is not allowing when using cached queries.

The compiler will accuse the code about missing a closing quote.
Just so you know, if I use this query dynamically it works, so I guess it's related to the code linting.

Query T() As %SQLQuery [ SqlProc ]{SELECT TOP 3 JSON_OBJECT('lit':'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee}

The bold part is what is causing the error.

Version 2017.

4
0 453
Question Evgeny Shvarov · Sep 4, 2017

Hi, folks!

What could be the best backup/restore strategy for a small (less than 100MB) but very valuable database which is placed on AWS/DO virtual host?

1. Use AWS/DO backup/restore features?

2. External backup (as the most recommended)?

3. InterSystems backup?

4. Globals export to a zipped file?

5. cache.dat copy?

Looking for the most robust and easy to use/implement method of backup and restore in a way "setup and forget" (until it becomes needed :)

2
0 717
Question Mike Kadow · Sep 2, 2017

When I go through the Atelier Cheat Sheet on the connection configuration, it talks about an Eclipse master password and asks for two hints to remember the master password. However, it does not specify the master password. I can only assume the master password is the same as the Cache instance password.

Can anyone shed some light on this master password, where or how it is used, and any other useful information?

3
0 498
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 1267
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 576
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 3682
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 916
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 431
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 706
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 1498
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 1388
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 485
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 587
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 1819
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 1036
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 1005
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 1845