ObjectScript

Syndicate content 36 

Hi,

     Can anyone please explain me how to remove trailing squares from the text field (String). Trailing squares is a white space ?

I tried different things like Ltrim, Trim from sql query side and also from object scripting side something below.

 If Address1 set Address1 = $ZSTRIP(Address1,"<>P,<>C,<>W")
 If Address1 set Address1 = $ZSTRIP(Address1,"$C(9), $C(32), $C(160)")
 If Address1 set Address1 = $ZSTRIP(Address1,"*W,*C")

Nothing works for me

Can anyone please help me to solve this

 

Thanks

Last reply 12 hours 37 min ago
0   0 3
49

views

0

rating

We have a vendor that every couple of days will just stop transmitting messages, but still hold the TCP/IP connection open. No matter how many times we troubleshoot and talk with them, they don't seem to think its an issue with system.  Normally if I just restart the service it will get the data flowing again.

Last reply 17 hours 3 min ago
0   0 3
34

views

0

rating

Hi Developers!

Many of you publish your InterSystems ObjectScript libraries on Open Exchange and Github.

But what do you do to ease the usage and collaboration to your project for developers?

In this article, I want to introduce the way how to introduce an easy way to launch and contribute to any ObjectScript project just by copying a standard set of files to your repository.

Let's go!

Last reply 5 days ago
+ 4   6 7
470

views

+ 4

rating

Hi Developers!

As you know the application errors live in ^ERRORS global. They appear there if you call:

d e.Log() 

in a Catch section of Try-Catch.

With @Robert Cemper's approach, you can now use SQL to examine it.

Inspired by Robert's module I introduced a simple IRIS Analytics module which shows these errors in a dashboard:

Last reply 9 days ago
+ 2   1 1
50

views

+ 2

rating

This is a coding example working on IRIS 2020.1 and on Caché 2018.1.3 
It will not be kept in sync with new versions      
It is also NOT serviced by InterSystems Support !   

In most cases, a global used by default storage has just 1 subscript level that represents the IDKEY.
For an index-globals we may see 2 or more subscript levels.
Arrays, or parent-child relationships or persistent classes extending a base data class
are examples where we see more levels. Though all these globals are quite uniform.

+ 2   0 1
0

replies

68

views

+ 2

rating

This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

During my search for a snapshot of a persistent object,
I met a feature that I would like tho share as it could be useful in some special situations.
My trigger was to have a before- and an after-image during unit testing.

Last reply 10 days ago
+ 7   4 5
298

views

+ 7

rating

Now I want to return a large amount of data to the front end. The string length has reached 40000 +, and the returned data needs to be encrypted by AES + Base64. I can convert the string into a stream. AES can use the AESCBCEncryptStream method to encrypt, but Base64 has no stream method。Anyone who get the solution  would you kindly share the solution please。

Any help would be appreciated. Thanks!

Last reply 11 days ago
+ 1   0 4
950

views

+ 1

rating

This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

Standard error logs in IRIS / Caché / Ensemble are written global ^ERRORS.
As this piece dates back some decades back to previous millennium its structure
is far from the typical SQL storage structures.

Last reply 11 days ago
+ 6   1 3
179

views

+ 6

rating

Hi Devs!

A few months ago I raised a discussion on the naming convention for ZPM modules.

And you free to put your name or your organization name for the packages you want to have your personal or company's brand.

But if you contribute to community, we suggested to have "community." package for all such libraries.

But the name is too long.

Last reply 11 days ago
+ 2   1 4
181

views

+ 2

rating

This is a coding example working on IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

A helper to List, Install, Uninstall ZPM packages

The offer of ZPM is growing daily and the short names and
acronyms of the offer are sometimes hard to understand and
also hard to type with my lazy fingers.

+ 7   0 1
0

replies

78

views

+ 7

rating

I face the challenge to have a bunch of classes on IRIS and CACHÉ in parallel
until all systems are migrated to IRIS.

Applying changes in Caché development environment and moving  to IRIS is no problem

But if I have to apply a fix on IRIS there seems to be no clean way back to Caché. 

Last reply 22 July 2020
+ 6   3 4
406

views

+ 6

rating

It would be interesting if there is some recommended documentation about best practices using Healthshare for interoperability.

Also, some how-tos or frequently asked questions about ObjectScript.

Or event better, if there are experienced developers who would like to share some common habits on their work with Studio / ObjectScript, which are valuable to do the developing work better.

For example, How to get the XML of a class and write it into a REST operation:

 

...

Last reply 21 July 2020
0   0 1
59

views

0

rating

This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

This  an example of a customized SystemFunction extension (ZZISJSON) in Caché & IRIS
This time it is  to be included in %ZLANGF00.mac

A JSON string is mostly imported from a file or over REST.
You rely on a clean and compatible structure. This is the check.

+ 4   0 1
0

replies

71

views

+ 4

rating

This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

It is also an example of a customized command extension (ZZJSN) in Caché / Ensemble & IRIS

This is the Caché version for fast JSON formatting. But iIt also works in IRIS .  
To allow parallel existence in IRIS with the previous example this is named ZZJSN

+ 2   0 1
0

replies

64

views

+ 2

rating

This is a follow-up to my previous article WebSocket Client JS with IRIS Native API as Docker Micro Server

Installation is now much simpler as all pieces are now assembled in a single Docker image.
That makes life easier. But of course, the principle of the Micro Service is not so obvious anymore.
An All-in-1 bundled package. Therefore compact.

+ 3   0 1
0

replies

114

views

+ 3

rating

 

This is a coding example working on Caché 2018.1.3 and IRIS 2020.2 
It will not be kept in sync with new versions 
It is also NOT serviced by InterSystems Support !

Background

Device #2 named SPOOL dates back to the predecessors of Caché and IRIS
It was the first "%Stream" like option to buffer output before printing.
It is also the first and still today the most simple way of output redirection.

+ 3   0 1
0

replies

60

views

+ 3

rating

Wrap JSON to multi lines / Test ISJSON

   This is a coding example working on Caché 2018.1.3 and IRIS 2020.2
   It will not be kept in sync with new versions   
   It is also NOT serviced by InterSystems Support !

install and usage

Packed Pretty.xml installs routine ZPretty in any namespace.
calling $$Do^ZPretty(input,[filler],[newline]) returns a wrapped JSON string.
filler is the optional string for the indent, default = "  "
newline is optional, default = $C(13,10)
input accepts: JSON_String, JSON_Stream, %DynamicAbstractObject

+ 3   0 1
0

replies

56

views

+ 3

rating

I need to set and use some context variables in a transformation (written in DTL), but the code is manually written.

When writing the same as BPL I define context variables and they are visible in transformations called by that process.

In something like this my.DTLtransform sets HL7 message fields to values in context variables:

Last reply 9 July 2020
0   1 5
95

views

0

rating

During the development of the Terminal Multi-Line Command Editor I discovered in my IRIS installation
a piece of software that I just can classify as a historic artifact. And it is still fully operational !!!

As it dates back to times before InterSystems was founded in 1978 you may understand my surprise.
I personally stepped into that environment in 1978 and used it then for daily work.

Last reply 6 July 2020
+ 15   0 1
151

views

+ 15

rating

Hi Developers!

Sometimes we need to import CSV data programmatically to InterSystems IRIS either from CSV or from URL. And we expect the class with proper datatypes to be created and the data to be imported.

I published a module csvgen on Open Exchange which does exactly that.

If you just need the CSV file be imported into IRIS you can do the following:

USER>do ##class(community.csvgen).Generate("/usr/data/titanic.csv",,"Data.Titanic")

Class name: Data.Titanic
Header: PassengerId INTEGER,Survived INTEGER,Pclass INTEGER,Name VARCHAR(250),Sex VARCHAR(250),Age INTEGER,SibSp INTEGER,Parch INTEGER,Ticket VARCHAR(250),Fare MONEY,Cabin VARCHAR(250),Embarked VARCHAR(250)
Records imported: 891
USER>

Or if you have the CSV on the internet, e.g. COVID-19 Data on Github you can get the data in the following way:

USER>d ##class(community.csvgen).GenerateFromURL("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/05-29-2020.csv",",","Data.Covid19")

Class name: Data.Covid19
Header: FIPS INTEGER,Admin2 VARCHAR(250),Province_State VARCHAR(250),Country_Region VARCHAR(250),Last_Update DATE,Lat MONEY,Long_ DOUBLE,Confirmed INTEGER,Deaths INTEGER,Recovered INTEGER,Active INTEGER,Combined_Key VARCHAR(250),Incidence_Rate DOUBLE,Case-Fatality_Ratio DOUBLE
Records imported: 3522
USER>

Last reply 5 July 2020
+ 4   1 3
160

views

+ 4

rating