#Caché

1 Follower · 4.5K Posts

  

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

Documentation.

Question Scott Beeson · Oct 6, 2016

I experience this constantly with Cache SQL.  Especially when querying the ATNA log.

SELECT TOP 400000 * FROM HS_IHE_ATNA_Repository.Aggregation ORDER BY ID DESC

That took 12 seconds.  I then upped the number to 500,000 and it took 185 seconds.

Shouldn't the execution time scale proportionately?

If I run the 500,00 query again it takes 2.4 seconds.

4
0 507
Article John Hotalen · Oct 4, 2016 1m read

How to parse a URL in Caché:

Let's pretend you are working on a project where you may be retrieving a URL for some purpose and you have the need to be easily able to parse apart that URL to get the various components that make up the URL.

Here's how to do that:

Note:  This example assumes you have a variable named sURL that contains some url (i.e. http://www.intersys.com/main.csp?QUERY=abc#anchor) and you will be creating an array of the URL component pieces, where the array will be named aComponents.

In your class/routine, add the following code:

Do ##class(%Net.URLParser).Parse(sURL,.aComponents)

8
0 1949
Question david clifte · Oct 5, 2016

I have to connect to an external database and I'd like to use the JDBC SQL Gateway.

I followed this tutorial [1] to create a JDBC SQL Gateway and after configured it works as expected, but I don't know

how use this connection into source code. Maybe these other tutorial is related [2] and [3].

[1] http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…

[2] https://community.intersystems.com/product-documentation/intersystems-p…

5
0 1056
Question Chris Stewart · Oct 7, 2016

Hi


I have been working on changing a web application from using %FileBinaryStream to storing and serving the file content from a %Stream.GlobalBinary property, stored in a new database.  I have managed to migrate the data across, and have also been able to redirect the stream so that it is being served through the web link.  However, the previous method set attributes on the File stream to have the stream be rendered as the original file type through MIME, using this code

do stream.SetAttribute("ContentDisposition","inline; filename="_filecvt)

2
0 1098
Question 吉光 芳史 · Sep 21, 2016

Hi, There

How to use open text file. I have a one file. the file is original file from excels file. After later convert to CSV file.

some cells has include cr+lf  control code. If i open and use from cache. reding time,Cache was wrong line feed point.

how do i edit my source code?

==============================================

s infile="c:\csvfile.csv"

o infile:"r"

1 u infile r line i $zeof<0 c infile q

   f i=1:1:10 s wd(i)=$p(line,",",i)

g 1

==============================================

4
0 1043
Edit
Question Thomas Chericka · Oct 7, 2016

Hi,

Thanks a million for taking the time to read this.

I'm calling the functions $ZF(-`1, <path to EXE>) and $ZF(-2, <path to EXE>) from Cache code. The exact code I'm using in Cache Studio is given below.

/// Test the functionality of ZF(-1) and $ZF(-2), 
Class %SourceControl.UnitTest Extends %Persistent
{
Parameter PATH As %String = "E:\VCS\CommandExecutor\bin\Debug\WindowsApplication.exe";
ClassMethod Test()
{
Do $ZF(-2, ##Class(%SourceControl.UnitTest).#PATH)
}

Now when I run the command in the Cache Terminal, as given below,

>do $ZF(-2, "E:\VCS\CommandExecutor\bin\Debug\WindowsApplication.exe")

0
0 2
Article Ben Spead · Aug 25, 2016 4m read

Background

Caché 2016.1 introduced some very powerful JSON features.  Unfortunately, the syntax used in the 2016.1 release is going to be changed in the 2016.2 release to bring it closer to Caché ObjectScript syntax.  This will mean that code that works in 2016.1 may not be forwards compatible.   See this announcement and this article for more details about the changes.

11
0 2112
Article Sylvain Guilbaud · Oct 4, 2016 6m read

This sample class will add parameter DSINTERVAL to each class containing the parameter DSTIME

To execute it from a Terminal :


SAMPLES>d ##class(adm.param).add(,,1)
[SAMPLES] parameter DSINTERVAL=5 added to class DeepSee.Study.CityRainfall (via adm.param)
[SAMPLES] parameter DSINTERVAL=5 added to class HoleFoods.Transaction (via adm.param)
[SAMPLES] parameter DSINTERVAL=5 added to class News.DeepSee.NewsArticle (via adm.param)
DSINTERVAL parameter was added to 3 classes
6
1 1100
Question William Proctor · Sep 30, 2016

Good Morning and thanks in advance for all replies.  I have created a PowerShell script for backing up CACHE and all related files to be run on a nightly basis.  My script works as long as the Unknownuser has %all access which is not acceptable in our production environment.  I have tried every format I can thank of to get the script to use a specific id with no luck.  How can I get this command to run under a specific id? 

..\bin\cache -s. -U%SYS "##Class(Backup.General).ExternalFreeze() <d:\backup\login.scr" 

The file just has

userid`r`n
​password`r`n

5
0 725
Article Mike Kadow · Sep 15, 2016 2m read

NewBie's Corner Session 27 Traversing A Global with $Order Part 1

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

Traversing A Global

Perhaps the most difficult concept in Caché/MUMPS is its Global Structure. This session and several that follow it deals with the Global Structure. However, just presenting the material will not guarantee your understanding of it. You must experiment with the data and concepts that are presented.

In this session, we are going to create a small Global of three levels deep, and then show the code to Traverse the Global.

20
0 879
Article Mike Kadow · Sep 23, 2016 5m read

NewBie's Corner Session 28 Various Methods to Traverse a Global

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

Judging from the number of responses to Session 27 Traversing A Global, developers are passionate about their methods. I am not here to judge the merit of the various methods.

Over the next few pages I will demonstrate a number of methods to Traverse a Global. If you don't already have a favorite they may help you pick one.

I will repeat the method from Session 27 just to have all methods in one post.

13
0 684
Question Rustam Ibragimov · Aug 5, 2016

Hello, guys.

I need to copy the text from one stream to another filestream and save it. I am using  

do fileStream.CopyFromAndSave(rtn.Code)

However, if "rtn" stream contains Russian characters I get something like "???". Is there any way to convert stream to Unicode?  Something like $zc(str, "O", "UTF8") for streams.

3
0 453
Question James Fitzpatrick · Sep 28, 2016

Hi all,

This is a real long shot, but does anyone have experience integrating MS wsHttpBinding with a Cache application?

Link 

I ask because my project had some initial design discussions for new web service communication and this specification was mentioned. 

Thanks.

1
0 353
Question Rustam Ibragimov · Sep 9, 2016

Hello, guys. 

I found one interesting moment in Cache Object Script. It doesn't have(or at least I didn't find) trimming function. By trimming I mean if a string has some whitespaces/tabs/carriage returns from very beginning or/and from very right, this function removes them. 

  I have found several workaround ways. 

1. Using Cache Basic

ClassMethod TrimCacheBasic(str As %String) As %String [ Language = basic ]{Return Trim(str)}

2. Using SQL

6
0 2068
Question Scott Beeson · Jun 21, 2016

I'm following the tutorial here.  When I try to call the default Test() method I get the following error:

An error occurred with the CSP application and has been logged to system error log (^ERRORS)

I found this document which says I need to make the "Web Application" accessible by running a couple commands.  I'm not even sure I created a Web Application.  Regardless, I tried a few variants but still get the same error.

Here is the URL for the Service Catalog: /csp/healthshare/mhclib/Custom.MHC.Scott.ServiceTest.cls

I tried different things including these two:

5
0 3248
Article John Hotalen · Sep 29, 2016 1m read

Checking if Directory or File Exists:

Outlined below is an example of how to check if a directory exists:

Set directoryName="c:\temp\nosuchdir"

/* Check for existence of a directory - Return Value:  0 - directory does not exist;  1 - directory does exist  */

Set directoryExists=##class(%File).DirectoryExists(directoryName)

If ('directoryExists)  // do the processing for when a directory does not exist


Outlined below is an example of how to check if a file exists:

1
0 3308
Question Chris Bransden · Sep 29, 2016

Hi all,

We're creating a series of RESTful APIs that output data from a Cache database (made up of global storage that we've mapped to classes). I'm running into some problems with object-to-JSON conversions when relationships are involved. Eg:

ParentClass has children relationship to ChildClass

ChildClass has parent relationship to ParentClass

1
1 706
Announcement Derek Robinson · Sep 26, 2016

Click here to view our OAuth 2.0 Overview

InterSystems created this video as a high-level overview of OAuth 2.0 technology, geared toward developers looking to learn the basics of OAuth 2.0.  It will teach you how OAuth 2.0 works, what roles are involved, what benefits it can provide, and how InterSystems Caché can be used with this technology.

3
0 651
Question Ponnumani Gurusamy · Sep 22, 2016
Hi ,
 1.  I will ready to write  a cache Developer Certification Level1. 
 2.  How to prepare this exam and any mock test available.
 3.  Where place to I will write exam . (Online as I will write a exam in my home place ).
 4. Will i Complete and pass 1st level , you will provide certificate.
1
0 670
Question Scott Beeson · Sep 27, 2016

I need to do an UPDATE via SQL and I would like the statement to return the `ID` column of each row that is updated.  MS SQL has an "OUTPUT" statement, but I don't see anything similar in Cache.  Is there a way to do this?

4
0 852
Article Mike Kadow · Sep 24, 2016 1m read

NewBie's Corner Session 29 Documentation on the Caché/MUMPS Global Structure

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

This post contains several links to very good documentation of the Caché Globals Structure.

Like I said, "Perhaps the most difficult concept in Caché/MUMPS is its Global Structure."

universalNoSQL.pdf - http://mgateway.com/docs/universalNoSQL.pdf

by Rob Tweed and George James

Extreme Database programming with MUMPS Globals

http://gradvs1.mgateway.com/download/extreme1.pdf

by Rob Tweed

Documentation from InterSystems on Globals

6
0 521
Article Steve Wilson · Sep 23, 2016 2m read

 Windows 7 and some other Microsoft Operating Systems can shutdown too fast for large applications, such as a Cache instance with a large amount of data and changes, to close gracefully. This results in the instance being forced down by the OS and so causing problems on the next start up.

To solve this we can change the OS shutdown timeout values to give Cache more time to close gracefully. We do this by editing some settings in the Registry.

1.Click Start (on Win 7) and type “regedit” and make sure you run registry editor as administrator.

 

9
0 2311