#Caché

30 Followers · 4.5K Posts

  

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

Documentation.

Question Keshav Iyer · Oct 30, 2018

What is the difference between %ID and ID in a database table? Both seem to reference the same column labelled ID.

For context, I am trying to create a viewer class for an existing persistent class.

Let us call the persistent class A, with SqlTableName = OldA.

The viewer class will be B with SqlTableName = A and ViewQuery = {select %ID, <other fields> from <some other class with the same fields as A>}

In A, there exists a class query: select %ID from A. However, A fails to compile, giving an error: "Field '%ID' not found in applicable tables". If the %ID is replaced with ID, the class compiles. 

1
0 1472
Question Satish P · Oct 29, 2018
Hi,
I was understanding the cluster configuration supported by the Cache. Have couple of queries around that:
1. In Cache version 2018.2, there is a shrading concept which splits the data of a Master Data server into multiple small data server which store shraded data.
How do we protect (backup and restore) such environment, should we also backup/restore the multiple small data servers along with  Master data server. Any documentation around this will really help.
2. In case of Cache DB Horizontal scaling, we keep adding multiple Application and data servers - to ensure load balancing -
3
0 442
Question Satish P · Oct 25, 2018

Hi,

We are trying to write an external backup application to backup Cache Database. After going through the Cache DB documentation, we have found that in Backup.General class there are methods for creating snapshot (Freeze/Thaw) which is required during backup. Are there REST APIs for the same?


Also we have the option of selecting individual DB instances in the management portal.  What are the methods/APIs of getting the DB list, so that user can select individual DB instances in an external backup application ? Do we have the methods/APIs to freeze/thaw the individual DB instances ?

Thanks!

5
0 784
Article Gevorg Arutiunian · Aug 22, 2018 1m read

(Originally posted on Intersystems CODE by @Eduard Lebedyuk, 10/12/15) The following code snippet outputs all filenames in the file path "dir" in the Cache/IRIS terminal. The class method "test" runs the code:


Class eduardlebedyuk.filenamesInDir Extends %RegisteredObject
{
	classmethod test() {
		// replace dir with file path you want
		set dir = "D:\directory" 
		set dir = ##class(%File).NormalizeDirectory(dir)
		set file=$ZSEARCH(dir_"*")
		while file'="" {
			write !,file
			set file=$ZSEARCH("")
		}
	}
}
3
2 2075
Article Alberto Fuentes · Feb 19, 2016 1m read

Attached code contains a very basic $system.WorkMgr example.

It uses several jobs (workers) to update different chunks of rows of a table.

Steps:

  • Creates a table with 100 records.
  • Split table  in chunks 
  • Initialize WorkMgr and queue chunks to workers.
    • Every worker simply sets its process number in the Job field of the processed row. 

In this case, I have tested the example in a 8-core laptop:

1
0 952
Question Rosti Zacharias · Oct 24, 2018

Hi,

I would like to know if anyone has had some experience in building systems for multiple end-users. 

To keep things simple, in a hypothetical example, say an Event Booking System, where a Venue could sign up to use such a system and define it's Venue, costs, calendars, etc.. and then invite their customers to book the Venue on different days/times. 

If I wish to offer such a system to many Venues, there are a number of options available.

6
0 2381
Question Seppo Kruth · Oct 25, 2018

I'm trying to set up a  webserver (Apache 2.4 on Windows 10) for a CSP application on a Cache which is not running on the same Computer. 

My Problem is that in the csp-pages there is a declaration:

<link rel="stylesheet" type="text/css" href="/jbsscan/stylesheets/style.css"></link>
<script language="JavaScript" type="text/javascript" src="/jbsscan/javascript/javascriptScanner.js"></script>
 

5
0 663
Article Gevorg Arutiunian · Oct 26, 2018 1m read

This code snippet contains the class method "test" which sends an HTML email. Change the literal strings in the method to customize the email's from address, to address, subject, and body:


Class objectscript.sendEmail Extends %RegisteredObject
{
	classmethod test() {
		set m=##class(%Net.MailMessage).%New()
		set m.From="user@company.com"
		 
		set m.IsHTML=1
		 
		do m.To.Insert("user@company.com")
		set m.Subject="Sent by IRIS mail"
		set m.Charset="iso-8859-1"
		do m.TextData.Write("<HTML><HEAD><TITLE></TITLE>"_$char(13,10))
		do m.TextData.Write("<META http-equiv=Content-Type content=""text/html; charset=iso-8859-2""></HEAD>"_$char(13,10))
		do m.TextData.Write("<BODY><FONT face=Arial size=2>Test <B>Test</B></FONT></BODY></HTML>")
		set s=##class(%Net.SMTP).%New()
		set s.smtpserver="mail.company.com"
		set status=s.Send(m)
	}
}

Here's a link to the code on GitHub

0
1 1280
Article Vasiliy Bondar · Oct 14, 2018 4m read

From the first glance, the task of configuring LDAP authentication in Caché is not hard at all – the manual describes this process in just 6 paragraphs. On the other hand, if the LDAP server uses Microsoft Active Directory, there a few non-evident things that need to be configured on the LDAP server side. Those who don’t do anything like that on a regular basis may get lost in Caché settings. In this article, we will describe the step-by-step process of setting up LDAP authentication and cover the diagnostic methods that can be used if something doesn’t work as expected.

3
2 2389
Job Simcha Gershon · Oct 20, 2018

Hi every body

I hope it's the right place & I'm not offending any body.

I'm a veteran Mumps/Cache/Ensemble programmer .  I think my only draw back is my age, although my brain is still young & bubbly.

I'm looking a long time for work without success.

I gathered a lot of knowledge & experience during those long years , developed many projects & i'm ready to do any work only to feel useful.

I'll add my resume, I hope & wish that this post will bring some change as I'm desperate to get some work.

Thank you very much Simcha my email is shiluvg@gmail.com

Covering letter

Good day

0
0 516
Question Scott Beeson · Jan 21, 2016

I want to do some logic based on what environment code is running in. I can't find a built-in function to retrieve this so I'd like to write a custom function. Does anyone know of a command that would get the current environment?

9
0 802
Question Scott Beeson · Jan 21, 2016

Here is the function I'm writing:

/// Returns the participant code based on MSH-4
ClassMethod getParticipant(iSendingFacility As %String) As %String [ Final ]
{
   set = $PIECE(iSendingFacility,"^",1)
   set = $PIECE(iSendingFacility,"^",2)
   set sc1 = Lookup("ParticipantCodeMap",a)
   if sc1 = "" {
      set sc1 = Lookup("ParticipantCodeMap",b)
   }
   q sc1
}

For some reason when I try to run it I get the following error:

 set sc1 = Lookup("ParticipantCodeMap",a)
 ^
<UNDEFINED> 

I tried adding the the default parameter in case it's not finding it but it didn't help.  What am I missing?

5
0 337
Question Guillaume Lepretre · Oct 18, 2018

Hello everyone,

I want to fill data into my select component with sql request and parameter.

I tried to follow this example https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE… 

I need to call a method because my parameter can be different. I tried something like this but it doesn't work... 

ClientMethod changeParams() [ Language = javascript ]{var query zenPage.getComponentById('categorieBeneficiaire');query.setProperty('parameter', 1, 'OS');query.setProperty('parameter', 2, 'NSAL');
}

or like this : 

2
1 346
Question Tiago Ribeiro · Oct 18, 2018

Hello all...

Is there two matching patterns in Caché, is there a difference in use one or the other?
Example:

USER>set a = "(1234)"

Using $match.

USER>w $match(a,"\([0-9]{4}\)")

USER>1

Using literal match (sorry if not correctly term expression)

USER>W a?1"("4n1")"

USER>1

What is different from using one or the other?

The 'a?1"("4n1")"' does this pattern exist only Caché.
Exists performance improvement with use pattern Caché?

2
0 660
Question Sean Connelly · Oct 17, 2018

I can directly order over a MultiDimensional property, e.g.

set key=$order(obj.prop(key))

However I have a generic method that has to use the $property method, if I know the keys then I can just fetch a value with...

set value=$property(obj,"prop","key")

But if I don't know the keys then I am not aware of a solution to do this, e.g.

set key=$order($property(obj,"prop",key))

will not work.

There must be an internal solution as a zw command on obj is able to list all of the keys. I'm wondering if there is a $zu function or other trick that can do this. Any ideas?

Thanks,
Sean.

6
0 619
Article Daniel Kutac · Apr 13, 2017 3m read

Recently, a partner company started to develop an Angular client for their Cache application. Together, we decided to leverage the power of Caché dynamic objects to exchange JSON encoded data between client and server parts. However, we realized that currently there is a gap in Cache JSON implementation that prevents simple use of traditional registered and persistent classes to exposed their data with the same ease as with XML. I wrote a small JSON adapter, that does the job and bridgers the gap. It's purpose is simple expose data described by a regular Cache class in a one-to-one fashion to a %DynamicObject. On the other hand, when a serialized JSON data comes in, it can be easily deserialized into dynamic object and subsequently bound to regular class by the newly created adapter.

7
1 2273
Question Stephen Wilson · Oct 8, 2018

I think I already know the answer to this but I thought I'd ask anyway. So the Node.js adapter allows you to perform operations directly on Globals. Does the InterSystems.Data.CacheClient.dll or InterSystems.CacheExtreme.dll provide a mechanism to access Gobals directly or are you accessing globals via Caché ObjectScript classes?

5
0 659
Article Gevorg Arutiunian · Oct 18, 2018 1m read

This code snippet uses %ZEN.Auxiliary.jsonSQLProvider. The namespace and string of SQL can be edited for different situations. The class method "test" runs the code:


Class eduardlebedyuk.passQuestionParams
{
	classmethod test(pValue = 50) {
		s ns = $Namespace
	    zn "samples"
	    s tSQL = "SELECT ID, Name FROM Sample.Person WHERE Id > ?"
	    s tPR = ##class(%ZEN.Auxiliary.jsonSQLProvider).%New()
	    s tPR.sql = tSQL
	    s tPR.%Format = "tw"
	    s tPR.maxRows = 100
    s tParam = ##class(%ZEN.Auxiliary.parameter).%New()
    s tParam.value = pValue
    d tPR.parameters.SetAt(tParam,1)
  
    d tPR.%DrawJSON() 
    //d ##class(%ZEN.Auxiliary.jsonSQLProvider).%WriteJSONFromSQL(,,,,,tPR)  //same thing
    zn ns
}

}

(Originally posted to Intersystems CODE by @Eduard Lebedyuk, 5/13/15)

Here's a link to the code on GitHub

0
0 347
Question Peter Kopp · Oct 17, 2018

I have a ZEN page with nine tablepanes. Each tablepane queries a table in the same SQLServer db. I have a single SQLGateWay(odbc) to this SQLServer db. I need to get better performance when I query all nine table at the same time. Would my performance improve if I had nine SQLGateWays(nine odbc configurations/connections), one for each query? I would appreciate any and all suggestions for getting the very best performance when using SQLGateWays. Thank you.

1
0 371
Question David Foard · Oct 17, 2018

I have created a view to stage some data in a different format and then want to reference that view in a SQL query from a table that filters the data from the view using a property of the table. 

Example:

select
   MsgId,
   FileName,
   (select
      ReportName
     from
      custom_view
     where
       MsgId = ReportId
    ) as ReportName
from
   main_table

Is this even possible? When I try this, I get an error table not found for the view?

David

1
0 338
Question William Proctor · Sep 27, 2016

All responses are appreciated.  I am new to both scripting and CACHE so please bear with me.  I am setting up a nightly backup script for freezing cache then backing it up and then thawing it back out.  Currently when I enter the freeze command I am getting a response of access denied even though my id has %all access.  I've tried passing the userid/password as a parameter in the externalfreeze command and passing it from a file.  I've used my id and lastly I used the _system id in the file.  What ID should I use for this or am I passing it wrong?

17
0 1262