#ObjectScript

14 Followers · 1.6K Posts

InterSystems ObjectScript is a scripting language to operate with data using any data model of InterSystems Data Platform (Objects, Relational, Key-Value, Document, Globals) and to develop business logic for serverside applications on InterSystems Data Platform.

Documentation.

Article Pravin Barton · Mar 28, 2019 2m read

ObjectScript has at least three ways of handling errors (status codes, exceptions, SQLCODE, etc.). Most of the system code uses statuses but exceptions are easier to handle for a number of reasons. Working with legacy code you spend some time translating between the different techniques. I use these snippets a lot for reference. Hopefully they're useful to others as well.

///Status from SQLCODE:set st = $$$ERROR($$$SQLError, SQLCODE, $g(%msg))  //embedded SQLset st = $$$ERROR($$$SQLError, rs.%SQLCODE, $g(rs.%Message)) //dynamic SQL///Exception from SQLCODE:throw ##class(%Exception.
5
23 3956
Announcement Evgeny Shvarov · Dec 2, 2019

Hi Developers!

For those who want to participate in the Advent of Code 2019 and code with ObjectScript in IRIS, I created a very simple but handy Github Template.

Use the green button

to copy template in your own repo, clone the repo and run in the repo folder:

docker-compose up -d

you will get InterSystems IRIS 2019.4 Community Edition running with the template classes to load input data from files and Day1 solution.

This is also set up to start crafting solutions of Advent of Code 2019 and edit, compile and debug ObjectScript with VSCode addon.

Happy coding with Advent of Code 2019!

0
0 314
Question Michel Bruyère · Nov 28, 2019

Hello,

I make some changes in our ObjectScript code between our prod environment  and dev environment in the process 'Hl7AdtFileIsoslBp'.

The operation is a class with "EnsLib.TCP.TextLineOutboundAdapter".

In prod:

In dev:

Like you can see, I don't have the contents of the text file.

I checked a lot of parameters but it seems identical.

The content of file is correctly received through TCP. So the only glitch is I don't see it in the 'View Full Contents'.

Best Regards.

10
0 671
Question Ikara Ikliki · Nov 15, 2019

When using $SYSTEM.Status.DecomposeStatus(tSC, .tErrorList) in ObjectScript to get the lsit of errors (I need to do this so that I can generate a custom JSON with the error messages) what is the type of tErrorList returned and how to intialize?

I need to know the type to iterate through it, I have tried dynamic array methods sich as %Size() also $LISTLENGTH to get the size, but both fails, so obviously not that, and being new to InterSystems I find the documentation assumes a new person knows what is behind the classes and how it was implemented from the start. The documentation of the does n

2
0 415
Question Ikara Ikliki · Nov 13, 2019

I have SQLCompute with SQLComputeCode on a couple of Properties in my class.

These work fin when I insert/update via ObjectScript or SQL from the ManagementPortal.

However, if I insert (create new record) via my C# app using the Caché ODBC DLL the SQLCompute is ignored, it does not run.

Is this expected InterSystems Caché behaviour? We are on latest IRIS platform.

7
0 530
Announcement Dmitry Maslennikov · Feb 17, 2019

I'm pleased to announce the latest version of extensions for ObjectScript. Just a month has gone since my latest update, and I already have something new to show.

Important. In this version connection to the server will be disabled by default. You have to activate connection through the settings:"objectscript.conn.active" = true.

12
1 1161
Question Flávio Lúcio Naves Júnior · Oct 21, 2019

Hello Everyone,

I'm want to know, what is more common for your company to use, the abbreviation syntax or the complety name of commands, and why?

Ex. 

S VAR=10 / D FUNC^ROUTINE F 1:1:1000

Set VAR=10 / Do Func^Routine / For 1:1:1000

set var=10 / do func^routine / for 1:1:1000

Here in my company, we are familiar with the abbreviation syntax, because to spell is more faster.

35
0 1178
Job Paul Lilienfeld · Nov 18, 2019

Good Morning- 

I am currently looking for a Cache ObjectScript Developer. Please see job description below. If you are interested please send an email to paul.lilienfeld@libertyits.com

Required Qualifications:
Bachelor s degree in Computer Science, Business Administration, Management Information Systems, Computer Engineering or equivalent experience/training
Working knowledge of programming languages
3+ years of experience developing and supporting mainframe applications in a collaborative environment that includes business experts and other software developers
Demonstrated desire and ability to

0
0 1130
Article Evgeny Shvarov · Sep 14, 2019 1m read

Hi Developers!

Often I find questions on how to install IRIS, connect to IRIS from IDE, setup the environment, compile, debug, maintain the repository.

Here below possibly the shortest way to set up all the environment and start development with ObjectScript on InterSystems IRIS.

Prerequisites

Make sure you have Git, Docker, and VSCode installed

Install Docker and ObjectScript extensions into VSCode

Sign in or Create an account on Github

Here we go!

9
6 1583
Article Fabio Goncalves · Apr 19, 2017 5m read

In the previous article, I have demonstrated a simple way to record data changes. At this time I have changed the "Audit Abstract Class" which is responsible for recording audit data and the data structure where the audit log will be recorded.

I have changed the data structure to a parent and child structure where there will be two tables to record the "transaction" and the "fields its values" changed on that transaction.

Take a look at the new data model:

Take a look at the code changed from "Audit Class":

Class Sample.AuditBase [ Abstract ]
{
Trigger SaveAuditAfter [ CodeMode = object

4
1 1186
Question Alex Kogan · Nov 5, 2019

I have a custom written date, setup as myDate in my application, which always behaved fine for years, and now it's acting a little weird. 

When I run SQL in Display mode the date shows as 1/10/1841 for some but not ALL rows.

When I run the same exact query in logical Mode the date shows normal format, in my case, for example 10/1/2019.  When the application is running is shows the incorrect date.  When I run the terminal session and open a ref point and ask to write a date is shows 10/1/2019, but I am expecting internal format here - 65287.   

I was wondering what is causing this issue.  I

4
0 401
Question David Sterngast · Nov 1, 2019

Hello!  I have basic web services application that java clients connect to the cache web services.  Using the browser, the user enters in the following url.

http://localhost:57772/csp/foia/%25SOAP.WebServiceInvoke.cls?CLS=SOAPFoia.SOAPServiceFoiaWeb&OP=FoiaApp30
'

which runs a soap method called FoiaApp30.   I am not sure how to add https  security to the web service calls.  I have reviewed documentation pertaining configuring SST/TTL configuration and other information.   Can somebody please help me out on what I need to do?   If I change the url  from http to https, the web service class wi

4
0 8257
Question Scott Roth · Oct 30, 2019

I must be missing something. We have done encoded PDF's in the past with the Encoded PDF in OBX.5.5. When I have used this code in the past I was only working with 1 OBX, but I have a case where I am having multiple OBX's and having to loop through them and I am renumbering the outbound OBX.

<code>
<![CDATA[ // OBX]]></code>
<assign value='1' property='varOBXindex' action='set' />
<assign value='1' property='varOBX1' action='set' />
<foreach property='source.{ORCgrp(1).OBRgrp(1).OBXgrp()}' key='k1' >
<if condition='source.{ORCgrp(1).OBRgrp(1).OBXgrp(k1).OBX:ValueType}="ED"' >
<true>
<assign value='



1
0 653
Announcement Anastasia Dyubaylo · Oct 24, 2019

Hi Community,

As you may know, we successfully held InterSystems Developers Meetup in Boston at Global Summit 2019. And now it's time to find out which solutions development on InterSystems IRIS have been discussed! 

Please welcome the Meetup video recording on InterSystems Developers YouTube Channel:

⏯ InterSystems Developers Meetup - Global Summit 2019

 

0
0 257
Question Yone Moreno · Oct 13, 2019

I  am reading the following code in ObjectScript:

GitHub repository
 

And there is a sentence which I am facing difficulties to understand:

    kill ^OPNLib.Game.CWLF(..World)

I know that kill removes variables, OPNLib.Game are the package and subpackage, and ..World is a property. However what does CWLF mean?

You could think that it is the class' name, but it is:

Class OPNLib.Game.ConwayLifeGame Extends %Persistent

The class name is ConwayLifeGame

Is CWLF an alias for the class name?

If yes where is it defined?

Because if we see all the definitions in the current class, we do not fou

2
0 270
Question Ting Wang · Oct 8, 2019

Hi All,

I am encountered <INVALID OREF> error in one of the components in the namespace as we are processing and generating huge files and sending them to downstream systems. One possible way we tried was to allocate more memory for the namespace in ensemble, but this kind of intermittent error still occurred only if processing the huge files. Also we tried to resend the failed message and the error would be gone. Another possible solution is to kill unused local variables to release memory space. My question is that what is more efficient way to deal with OREF error related to memory allo

2
0 3765
Question Ting Wang · Oct 8, 2019

Hi,

I got the <INVALID OREF> error in the component and the error screenshot as follows:

​​​​​​

When I try to debug in the code, I go to the class and view other code in eclipse and find out the error method. How should I determine which line threw the error according to the error? There is the line number"+8" in zProcessRequest method. Is that the line counted from the method name or below? Looking forward to your reply. Thanks.

4
0 1417
Question Ciaran Mooney · Sep 20, 2018

HI,

I am a newbie so excuse my basic questions.

I have installed Caché on Mac Os High Sierra 10.13.6 and have started the ObjectScript tutorial but I cannot open Terminal in Caché.

The instructions provided on the tutorial don't appear to be for Mac OS as there is no cube icon:


n order to begin practicing using ObjectScript, you need to start the Terminal. Click the Caché cube iconin the task bar and select Terminal from the menu. This brings up the terminal window, and you can see from the prompt that we are in the USER namespace. Namespaces are logical directories, containing routines (programs)

10
0 1152
Article Evgeny Shvarov · Sep 29, 2019 2m read

Hi Developers!

When you prepare your modules for ZPM (InterSystems Package Manager) it expects the certain directory structure for ObjectScript source files.

ObjectScript in your source folder need to be stored by types in the following subfolders. E.g. if you have the source folder named as /src the structure should be as follows:

/src

        /cls - for classes

         /inc - for include files

         /mac - for mac files

         /int - for interpretable files

         /gbl - for globals

And the ObjectScript should be in CLS (a.k.a UDL) and not in XML.

Example.

Ok! But how coul


0
1 859
Question Rizmaan Marikar · Sep 22, 2019

Hi All,

I have a class method, this can be any cache expression to execute (usually a class / method and args) and and args stored in a variable, for example;

set aa = "##Class(Utils.Test).Run(1,2,3)"

do aa

I tried using $classmethod(class,method,args..), by extracting the values but sometimes there can be no arguments, or arguments such as ;

("2019-01-01","1,2,3,4")

which causes issues while running the $classmethod, (i am using $P to extract the Class, Method and args).

Is there any simpler way of doing this?

4
0 359
Question Scott Roth · Sep 19, 2019

We have a case where we have 1 message coming in, but then sending two messages out to the same location. Even with FIFO sometimes the messages get out of sequence depending on what is need to be done to the message in the DTL before send. Is it possible to call sleep or Halt or write some kind of a function to put a pause in a routing rule between two sends?

5
0 797
Question Jeffrey Drumm · Sep 17, 2019

I've created a scheduled task that dumps HL7 messages to flat files. It uses the OutputToLibraryStream() method of EnsLib.HL7.Message. I'd like to be able to run it on a mirror member host whether it's primary or backup.

When run against a database that's mounted read-only, it works fine. However, when I attempt to run it against a mirror backup database, I get the following error:

#5002: Cache error: <PROTECT>%LoadData+7^EnsLib.HL7.Message.1

Tracing that back to the source, I find:

Lock+(^EnsLib.H.MessageD(id)#"SE"):$zu(115,4)

Can someone help me understand how locking might behave differently on

9
0 580
Article Evgeny Shvarov · Jul 13, 2019 2m read

Hi guys!

Was coding today with InterSystems IRIS in a docker container and decided to share with you the commands you may find useful in everyday coding.

# docker-compose build

command to build a container. Remember, it is useful if you have dockerfile in the repo.

if the build is successful call the following to launch it:

# docker-compose up -d

Find IRIS management portal on:

localhost:port/csp/sys/%25CSP.Portal.Home.zen?$NAMESPACE=%25SYS

where the port is what you set in docker-compose.yml - 52775 in this case.

Run the following if you want to launch a terminal session inside IRIS container:

# docker-compose iris iris session iris

gfhj gj 


sdfdsfsdf





USER>

And run the following to shut down the container:

# docker-compose down

Troubleshooting

4
4 731