#Caché

1 Follower · 4.5K Posts

  

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

Documentation.

Question Fabian Pie · Jan 19, 2019

Hi,

I'm using node.js to access to Iris.

Considering this globals:

^Customer(1, "Address", 1)="London"

^Customer(1, "Address", 2)="UK"

^Customer(1, "Name")="Jane K. White"

^Customer(2, "Address", 1)="Reigate"

^Customer(2, "Address", 2)="UK"

^Customer(2, "Name")="Peter R. Black"

^Customer(3, "Address", 1)="London"

^Customer(3, "Address", 2)="UK"

^Customer(3, "Name")="Paul J. Green"

I retrieve all customers with: 

mydata.retrieve( { global: "Customer" },

"array",

function(error, result) {

if (error) {

// error (see result.ErrorMessage and result.ErrorCode)

} else {

// success

} } );

12
2 398
Article Dmitrii Kuznetsov · Jan 21, 2019 10m read

Headache-free stored objects: a simple example of working with InterSystems Caché objects in ObjectScript and Python

Neuschwanstein Castle

Tabular data storages based on what is formally known as the relational data model will be celebrating their 50th anniversary in June 2020. Here is an official document – that very famous article.  Many thanks for it to Doctor Edgar Frank Codd. By the way, the relational data model is on the list of the most important global innovations of the past 100 years published by Forbes.

0
3 917
Question Eduard Lebedyuk · Sep 5, 2017

Let's say I have this property:

Property FavoriteColors As List Of %String;

I heed to convert it to JSON using SQL or at least without object access (so direct global access).

What's the fastest way to do that?

I thought about JSON_ARRAY and JSON_ARRAYAGG sql functions but they don't do that.

5
0 1340
Question Eduard Lebedyuk · Dec 27, 2018

I have an in-memory list of items and I want to check which items match my pattern string.

Pattern string is a comma-separated list of items and special symbols like '*' and maybe '?'.

There's something similar in $system.OBJ.Compile, it accepts patterns: "*.data.*,Sample.*" -  and it would compile 'Sample' package and all 'data' packages.

For example:

set list=$lb("abc", "c", "aaa", "bbb")
set result = ..match(list, "a*,*b")
zw result
result=$lb("abc","aaa","bbb")
7
0 877
Question Adrian Zeeman · Jan 17, 2019

Hi there,

I've been busy setting up Perforce source control on a Cache 2017.2.2.865.0 instance. Everything is mostly done and working through studio hooks. Checking out, modifying and checking back in works correctly but I would like to know what the hook, override, setting is to force studio to check if the class needs to be checked out or is already checked out by another user before you are allowed to edit it.

3
1 809
Question Eduard Lebedyuk · Apr 3, 2017

I need to convert timestamp into HTTP-date as defined in section 3.3.1 of [RFC2068]HTTP-Date can have several representations, but preferable view is defined by RFC 822, updated by RFC 1123 and looks like this:

wkday "," SP date1 SP time SP "GMT"

Here's an example of HTTP-date value:

Sun, 06 Nov 1994 08:49:37 GMT

The problem I encountered, is that if server locale is not English, then $zd, $zdt and TO_CHAR return localized names of weekday and month (i.e: Вос). Is there a way to get English names of weekday and month regardless of server locale?

Just checked TO_CHAR and it also calls $zd.

3
0 588
Question Eduard Lebedyuk · Jan 17, 2019

I have a persistent class.

I want to store one of the properties there as a stream or a string depending on a size.

99% of values would be strings (less than $$$MaxStringLength characters) so I don't want to store everything as streams.

What do you think of this approach?

What's the best architecture to implement in this situation?

4
0 700
Announcement John Murray · Jan 14, 2019

At the George James Software booth at Global Summit last year we took the wraps off the work we've been doing to make our popular editing and debugging tool Serenji available on the Visual Studio Code platform.

Rather than requiring you to pull code from your namespaces into local files, then push the changes back to the namespace to run it, you work directly in the namespace. In other words, the editing experience is like Studio rather than like Atelier.

As well as editing code you can also debug it directly from VSCode.

12
1 879
Question Anthony Harrison · Jan 14, 2019

Hi,

We are using Cache to generate HTML pages (complete with Javascript), which we are reading in an Android phone App's WebView.

If, when we generate HTML as follows:

<html>

<body bgcolor='red'>

Hello World

</body>

</html>

Reading this is iPad gets what you would expect, a red page with Hello World written in it.

However in Android phone, the page is both white and blank.

16
0 373
Question Chris Sprague · Jan 23, 2018

I've mapped multiple tables (UNION on mapped SQL classes) into a view, using CREATE VIEW.

Through ODBC, in Entity Framework, I am querying against that view and offering paging. The paging is implemented using IQueryable.Skip and IQueryable.Take. 

Skip seems to have unexpected results, I believe due to incorrect SQL generated by the Entity Framework provider, though perhaps I've done something incorrectly. The generated SQL looks similar to this (with some bits replaced or altered for security reasons), the basic structure is unaltered.

11
0 748
Article John Kumpf · Jan 14, 2019 2m read

This is a quick note on what happens when, on your CSP page, you call a cache script which returns a %Boolean and store that value in a javascript variable.

When you call a script with language="cache" and returntype="%Boolean" from a javascript script, the return value is interpreted as a string, not as a boolean.

Here's an example:

A cache script that returns (in theory) a "false" value:

<script language="cache" method="giveMeAFalse" arguments="" returntype="%Boolean" procedureblock='1'>
return 0
</script>

A javascript method that logs what the value's actually interpreted as:

3
0 608
Question Duncan Priest · Sep 5, 2018

I'm writing a SOAP client in Ensemble (2017.2.2) that is required to pass empty elements to the SOAP server in the form <xsi:type="ns:ResponsibleUser"/> where ResponsibleUser is a class that itself has no properties. I initially thought I'd found the answer with the XMLIGNORENULL parameter of XML enabled classes but this didn't make any difference for SOAP requests, only working when I wrote the XML to a file. Then I came across the XMLIGNORENULL parameter for the SOAP client class (inherited from %SOAP.WebBase), but this only works for %String properties and not for properties of arbitrary

1
0 609
Question Thembelani Mlalazi · Jan 15, 2019

I have an sql statement that I would like to execute but I get the error

"zSearchChanges+5^MergeHyland.TypeTwoUtil.1 *KeyID"

and here is my sq

l  "&sql(SELECT Key INTO :KeyID FROM MergeHyland.TypeTwoDimesionalTable WHERE Key = :Key)" any ideas why 
2
0 297
Question Dmitrii Kuznetsov · Jan 9, 2019

Found a strange documentation block about Python bindings in Chapter 3.6 of the Caché manipulation functions with time and date. It looks like this text accidentally copied one to one of the Perl binging documentation. It's funny that the packages of functions called PTIME_STRUCTPtr, PDATE_STRUCTPtr and PTIMESTAMP_STRUCTPtr is suspicious for Python :)  

On the other hand, nothing is said about the functions parse_time, parse_date, parse_timestamp, which are present in /dev/python/intersys/pythonbind.py ahhh!

Has anyone encountered this problem?

2
1 594
Article Gevorg Arutiunian · Jan 11, 2019 2m read

This code snippet sends an XML request to a server and saves the response to a file. The class method "test" runs the code:


Class objectscript.postXML
{
	classmethod test() {
		Set HTTPRequest = ##class(%Net.HttpRequest).%New()
	    Set HTTPRequest.ContentType = "text/xml"
	    Set HTTPRequest.NoDefaultContentCharset = 1
	    Set HTTPRequest.Location = "ITOMCZ"
	    Set HTTPRequest.Server = "wph.foactive.com"
	    Do HTTPRequest.RemoveHeader("User-Agent")  
	    Do HTTPRequest.RemoveHeader("Accept-Encoding") 
	    Do HTTPRequest.RemoveHeader("Connection")
	    Do HTTPRequest.SetHeader("Expect","100-continue")
    Set RequestXML = ##class(%Library.File).%New("c:\test.xml")
    Do RequestXML.Open("RS")
    Do HTTPRequest.EntityBody.CopyFrom(RequestXML)
    Do RequestXML.%Close()
 
    Do HTTPRequest.Post(HTTPRequest.Location)
 
    Do $System.OBJ.Dump(HTTPRequest)
    Do $System.OBJ.Dump(HTTPRequest.HttpResponse)
 
    Write HTTPRequest.HttpResponse.Data.Size
    Write HTTPRequest.ContentLength
 
    Set ResponseStream = ##class(%Stream.FileBinary).%New()
    // Second part is typically the file extension, i.e.: application/pdf -&gt; pdf
    Set FileType = $Piece(HTTPRequest.HttpResponse.GetHeader("CONTENT-TYPE"),"/",2)
    Set ResponseStream.Filename = "C:\test."_FileType
 
    Write ResponseStream.CopyFrom(HTTPRequest.HttpResponse.Data)
 
    Write ResponseStream.%Save()
    Do ResponseStream.%Close()
}

}

Here's a link to the code on GitHub

0
0 949
Article Steve Pisani · Jun 6, 2016 7m read

This is a posting about a particular feature of Caché which I find useful but is probably not well known or used. I am referring to the feature of Language Extensions.

This feature allows you to extend the commands, special variables and functions available in Caché Object Script with commands, special variables and functions of your own. This functionality also applies to other languages the Caché supports at the server, including Caché Basic and Multivalue Basic.  


Why would I need or want to add new commands ?

5
4 1511
InterSystems Official Jeff Fried · Jan 9, 2019

Caché  2018.1.1 and Ensemble 2018.1.1 maintenance releases are now available!   

Full product installation kits can be downloaded from the WRC Software Distribution site.

For information about the corrections in this release, refer to the release notes.

 

This release is supported on the same platforms as Caché and Ensemble 2018.1.  You can see details in this Supported Platforms document.

0
0 1686
Question Michael Davidovich · Jan 3, 2019

Hello,

I have some beginner questions as I am working through the InterSystems Cache learning path:

- Where I work, we us Cache, but we often learning about and train on MUMPS.  No one really talks about or mentions MUMPS here, but my understanding is that ObjectScript is basically MUMPS plus whatever new things InterSystems put on top of it.  Is that a fair assessment?

- The training online often refers to IRIS.  We don't use IRIS, but we use globals to store data.  I suppose I'm just confused on the difference between Cache, Zen, IRIS and other products as they all seem to do similar things.  

16
0 884
Question Scott Roth · Dec 21, 2018

Has anyone called any outside Javascript code from inside their class files? I asked a long time ago if there was a way to manipulate an image within Cache Object Script, and since Cache doesn't have any image libraries its not really possible. However I have found Javascript to resize an image and wonder how hard it would be to mesh the two together.

Can anyone share any examples?

Thanks

Scott

9
1 1641
Question Chip Gore · Jan 2, 2019

Hi -

I'm wondering if anyone has coded up a means to create an extension for a %Persistent class from a base class to a sub-class without making a ton of assumptions about the Global structure. I'm trying to create a new "extension" record that would have the same ID as the Base Class 

Class BaseRecord Extends %Persistent

and

Class SubRecord Extends BaseRecord

where I would have an instance of a "BaseRecord" and I want to turn it into a "SubRecord" instance and have all of the existing references to the BaseRecord survive.

7
0 550
Article Rob Tweed · Dec 13, 2018 2m read

There's a new and exciting enhancement to QEWD that has just been released - it's an additional layer of abstraction known as QEWD-Up.  QEWD-Up hides away all the mechanics of QEWD itself, allowing you to focus on just your REST APIs and the code that implements them.

Additionally, and importantly, QEWD-Up simplifies the maintenance of your REST APIs, allowing you (and others) to quickly and easily understand their life-cycle and implementation.

QEWD-Up supports both monolithic application designs and MicroService-based architectures where APIs are broken down by, for example, functional role.

3
4 902