Article Gevorg Arutiunian · Dec 13, 2018 2m read

(Originally posted by @Ben Spead on June 25, 2014)

This code snippet generates a list of Ensemble Lookup Tables and Schema documents in the user's current namespace. Run the code by running the class method "test":


Class benspead.EnsTablesSchema
{
	classmethod test() {
		If ##class(%Dictionary.CompiledClass).%ExistsId("Ens.Util.LookupTableDocument") {
		    // only supported in Ensemble 2012.1+
		    Write !,!,"Exporting Ensemble Lookup Tables..."
		    Set sc = $$$OK
		    Set rs = ##class(%ResultSet).%New("Ens.Util.LookupTableDocument:List")
		    Do rs.Execute()
		    While rs.Next() {
		        Set item=rs.Data("name")
		        Write "document found: "_ item,!
		    }
		    Do rs.Close()
		    Set rs=""
		}
		If ##class(%Dictionary.CompiledClass).%ExistsId("EnsLib.HL7.SchemaDocument") {
		    Write !,!,"Exporting Ensemble HL7 Schemas..."
		    Set sc = $$$OK
		    Set rs = ##class(%ResultSet).%New("EnsLib.HL7.SchemaDocument:List")
		    Do rs.Execute()
		    While rs.Next() {
		        Set item=rs.Data("name")
		        Continue:$listfind($lb("2.1.HL7","2.2.HL7","2.3.HL7","2.4.HL7","2.5.HL7","2.6.HL7","2.7.HL7","2.3.1.HL7","2.5.1.HL7","2.7.1.HL7","ITK.HL7")
		                            ,item)
		        Write "document found: "_ item,!
		    }
		    Do rs.Close()
		    Set rs=""
		}
	}
}

Here's a link to the code on GitHub: https://github.com/intersystems-community/code-snippets/blob/master/src/cls/benspead/EnsTablesSchema.cls

3
0 951
Question Leon Duveen · Aug 20, 2019

I have set up a process to produce a daily file to be submitted to another system and this is working (using EnsLib.RecordMap.Operation.FileOperation).  However, the file needs to have a header line added each time it is created so it can be processed by the down stream system.  Looking though EnsLib.RecordMap.Operation.FileOperation and EnsLib.File.OutboundAdapter, I can't see where I can do this easily.  Any suggestions?

Thanks

3
0 486
Question Jude Mukkadayil · Aug 15, 2019

Hi,

    I am trying to create a new report on Trakcare. I created a class file and corresponding crystal report . It works fine and data is populating when I try to run on crystal environment. But when I make a setup on Trakcare and click on print option, I am getting an error on print history " VB error in tkCrystalJob] Error number[-2147417848] Method '~' of object '~' failed [at line 421]". If I click on print preview option its going to empty browser. Inorder to setup new report, already made set up on report manager and menu manager.

Can anyone have any idea abt this error?

Thanks

1
0 589
Question Bharath Nunepalli · Aug 20, 2019

I'm a DBA and support Caché databases on AIX. I coded shell scripts for monitoring journaling status, databases size, license end date.

We recently got a new instance of Caché on Windows. I'm just curious to know whether anyone coded database monitoring scripts on Windows using PowerShell or any other scripting language.

If yes, please share the details.

Thanks & Regards,

Bharath Nunepalli.

3
0 583
Question Scott Roth · Aug 19, 2019

I have a colleague that is trying to eliminate any HL7 transactions that have admit date/time of midnight from going to an downstream system within a routing rule. I have tried several different iterations of code trying to figure this out just in the routing editor. Without having to write an object script function is this possible?

((HL7.{PV1:AssignedPatientLocation.PointofCare}="D3")||(HL7.{PV1:AssignedPatientLocation.PointofCare}="D4"))&&(SUBSTRING(HL7.{PV1:AdmitDateTime.Time},9,12)!=0000)

Thanks

Scott Roth

4
0 476
Question ED Coder · Aug 16, 2019

Hi, I am trying to get my values into a mySQL DB but for some reason it doesnt seem to go into the DB. I do not get any errors. Would appreciate some guidance on this.

ClassMethod Orders(pRequest As EnsLib.HL7.Message) As %String [ Final ]
{
/
pidSeg = pRequest.FindSegment("PID")
mrn = $p(pidSeg.GetValueAt(3),"^",1)
obrSeg = pRequest.FindSegment("OBR")
obrdate = obrSeg.GetValueAt(6)
obrdesc = $p(obrSeg.GetValueAt(4),"^",2)
obrstat1 = $p(obrSeg.GetValueAt(40),"^",2)
obrstat2 = $p(obrSeg.GetValueAt(40),"^",3)
obrstatus = obrstat1_" "_obrstat2
orcSeg = pRequest.FindSegment("ORC")
consulta

17
0 557
Question Gagan Kaushik · Aug 14, 2019

Hi

I am trying to upload a file to a ftp site using following code. Problem is file is getting upload but there is no data. Can you plz advise where I am getting lost. Also my files are with big data, 2+ GB, as far as know this ftp upload will not effect on my cache.dat size. Plz correct if my understanding is not correct.

Set ftp = ##class(%Net.FtpSession).%New() set sc = ftp.Connect("myFtpServer","myUserID","myPswd") Set filestream = ##class(%Library.FileCharacterStream).%New() Set sc = filestream.LinkToFile("\Temp\GaganTest") set newname = "PrintWaitDetail-14936.xls" Set sc =

3
0 690
Discussion Evgeny Shvarov · Aug 18, 2019

Hi Developers!

InterSystems IRIS stores everything in globals and if we use ObjectScript classes to persist data class documents globals it uses in storage. But if you use globals for calculations, temporary storages, for special indexes or for some other purposes - how do you document it?

Possible options which come to my mind:

1. Macro

#define Array ^MyGlobal

usage:

s $$$Array(1)=1

2. Class parameter

Parameter Array ="^MyGlobal";

Usage:

s @(..#Array)@(1)=1

3. Documentation comment

Just document it to have it in a class documentation

/// ^MyGlobal is used to store my data

What do you do?

3
0 427
Article Jose-Tomas Salvador · Aug 14, 2019 5m read

Object Synchronization is a feature that has been around for a while, since Caché days, but I wanted to explore a bit more how it works. I've always thought that database automatic synchronization is complex by nature but, for some particular scenarios shouldn't be so hard. So I considered a very simple use case (OK, perhaps the typical one, I'm not discovering anything... but if it's common and it works, it's good wink ). You can download from GitHub and compile it into your system, generate sample data and play a bit with it. It's done for InterSystems IRIS but it also should work in last

1
2 570
Question David.Satorres6134 · Aug 19, 2019

Hi all,

One of the most useful features for me in IRIS was the queue page. From there, I could see how the different elements (BS, BP & BO) from a production were behaving, thanks to the possibility of auto-refresh every second. Great thing.

But we have updated to 2019.1 and this possibility is gone... we need to refresh manually! So, is there any way to set a parameter somewhere to have the queues status refreshed automatically?

Thanks a lot.

1
2 443
Question Eduard Lebedyuk · Aug 17, 2019

 I have two local instances:

  • IRIS for Windows (x86-64) 2018.1.2 (Build 626_3U) Wed Jun 12 2019 19:07:59 EDT
  • IRIS for Windows (x86-64) 2019.1 (Build 510U) Thu Mar 14 2019 14:13:37 EDT

I'm using Java Gateway to talk to external system.

Both instances are using the same:

  • jar
  • generated class
  • java version


They are calling the same method with this java signature:

package isc.rabbitmq;
public class API {
    public void sendMessage(byte[] msg) throws Exception {}
}

On the InterSystems IRIS side I'm calling it like this:

set sc = ##class(%Net.Remote.Service).OpenGateway(gatewayName, .gatewayConfig)
set sc
1
1 273
Question David Miranda · Aug 15, 2019

Hi,

Is there any way to set environment variables in Linux from Cache?

I see a way to get an environment variable with: $system.Util.GetEnviron()

Essentially I am converting from VMS (DCL) to Linux.

In VMS we used $ZF(-1,"SETSYM") in Cache to a value and then interpreted that value in a DCL procedure.

Actually, I think I should just explained the need.

2
0 970
Article Lexi Hayden · Jul 18, 2017 2m read

The newer dynamic SQL classes (%SQL.Statement and %StatementResult) perform better than %ResultSet, but I did not adopt them for some time because I had learned how to use %ResultSet. Finally, I made a cheat sheet, which I find useful when writing new code or rewriting old code. I thought other people might find it useful.

First, here is a somewhat more verbose adaptation of my cheat sheet:

1
%ResultSet::%New()
%SQL.Statement::%New()

2

   Call the Prepare() instance method

   Call the %Prepare() instance method

3

   Previous step returns status; check that

   Previous step returns status; check that

4

35
4 2531
Question Thembelani Mlalazi · Aug 15, 2019

I have a list property that I query from the database to get the values contained in that list using $LISTFROMSTRING() when the list is returned the list values contain a rectangle like character similar to when you copy past something to the Terminal and it has a preceding space .The problem is I need to compare those values to other values and they do not match because of this value I have tried to use $EXTRACT(value,*W) and *P but this is not striping the preceding character how do I get rid of this character any ideas please. 

the values returned from the Database 

here is what I have tried

3
0 677
Question John Bland · Jul 24, 2019

In Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.2 (Build 309U) Mon Mar 4 2019 15:07:46 EST

I have a master record that has a relationship to a table with multiple transactions, and the transaction table has a relationship to another transaction table with multiple other transactions.

IE Item to Physcal to Physical Report

Item Master:

Relationship PhysicalRecord As User.pytrn [ Cardinality = many, Inverse = ItemRecord ];

First transaction table

Relationship ReportRecords As User.pyrpt [ Cardinality = many, Inverse = PhysicalRecord ];
Relationship ItemRecord As User.immst [ Cardinality

5
0 515
Article Brendan Batchelder · Jun 20, 2016 1m read

The message viewer can resend messages but it is not suitable for resending a large number of messages (>100).  For that, you should use Cache Object Script code such as the following:

Class Sample.Resender Extends %RegisteredObject
{
ClassMethod Resend()
{
//Resend all messages sent from 'FromComponent' to 'ToComponent' between 2016-06-15 and 2016-06-20
&sql(DECLARE C1 CURSOR FOR
 SELECT ID INTO :id FROM Ens.MessageHeader
 WHERE SourceConfigName='FromComponent' AND TargetConfigName='ToComponent'
 AND TimeCreated BETWEEN '2016-06-15' AND '2016-06-20')
&sql(OPEN C1)
&sql(FETCH C1)
set tSC = $$$OK
while (S
7
3 2444
Question Cyriak John · Aug 12, 2019

We have created a custom SDA container to store a certain kind of new, customized patient data.

We are observing a behavior in the correspoding analytics table for this custom SDA class where rows are added for a patient for which the MPI is null and the patient record does not exist.

From what we can tell, it seems that, when there is a MPI link/unlink, rows are added to analytics linked to the new Patient record that contains the latest MPI, but the old rows linked to the old (now non-existent) Patient are not removed.

2
0 343
Question Jenna Makin · Aug 12, 2019

Hi

Is there any way to control what control sequence is sent to a device when a   "write #" is executed?

I have an application that establishes a banner at the top of the terminal window and when we do a   "write #" the banner disappears.  I need to be able to recreate the banner line as part of the screen clear.

Thanks

Jenna

3
0 440
Question Stephen Wilson · Aug 13, 2019

I have an OAuth 2.0 development environment where Caché is serving all three roles as the Authorization Server, Client and Resource Server based on a great 3-part series on OAuth 2.0 by @Daniel Kutac. I have a simple password grant type where an x-www-form-urlencoded body (as described in this post) is sent as a POST to the token endpoint at https://localhost:57773/oauth2/token and a response body with a HTTP Response 200 header is returned. The response body looks something like this.

3
0 2822