#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.

Question Emil Odobasic · Dec 14, 2023

Hello everyone!
I have to build a REST service that receives a POST HTTP-request, collect a file from that request in the Form data and then send it in another HTTP Post request through Form Data. However I can't really seem to send the file, and I do not know where it has gone wrong. All I am getting told is that no file is being received from my HTTP Post request. I am reaching the REST Service I am supposed to send the request to, but nothing is being sent.
I would be really thankful if someone could give some insight why nothing is being sent in my request. Thanks beforehand! :)

6
0 995
Question David Hickman · Dec 12, 2023

I'm receiving a JSON payload via a REST API, I'd like to %JSONImport this stream into a class which extends %JSON.Adaptor. The problem is that the JSON is an array whose elements have no key (as you can see in the example JSON below). Right now I'm having to do some manipulations to convert the stream into a dynamic object and do a %Set which inserts a made up key "record" so "thingone" and "thingtwo" have an associated key that I can use when referencing "thingone" and "thingtwo"...such as record.GetAt(1).thingone

3
0 368
Question Colin Brough · Nov 21, 2023

How do we trigger a BPL Business Process on a time schedule?

We are building a production that takes a steady stream of (HL7) lab results messages, processes them and stores them in a temporary database table. At scheduled points during the day (eg 0800, 1300, 1600) the database is queried and messages sent on to the downstream system. Aiming that the Processes to be implemented in BPL if possible - but we are having trouble triggering code in a BPL as a scheduled job.

12
0 739
Article Luis Angel Pérez Ramos · Dec 5, 2023 3m read

Welcome everybody!

In this short article I would like to present an example of use that surely many of you who work with IRIS as the backend for your web applications have faced on more than one occasion and it is how to send a file to your server from the frontend.

Generally the simplest way I have found to perform this task is to transform the file from the frontend to the Base64 format and make a POST call to our server attaching the Base64 obtained to a JSON message in which I indicate in a parameter the name of the file and in another the encoded data. Something similar to this:

2
0 733
Question Scott Roth · Nov 17, 2023

I am attempting to setup my first OAuth2 client, as we are adventuring into the realm of making FHIR API calls to our EMR from HealthShare Health Connect. 

I have gone through and set up the Issuer Endpoint, and Client Configuration but now I want to test it and verify that the setup is correct. When I setup the Client Configuration, it would not allow me to use Discovery as it was saying I needed a "Client secret" but was not given one. So I set it up manually, thinking I hit all the information correctly.

2
0 426
Question Mary George · Nov 29, 2023

Hi Community, 

Can I please check if any one is aware of any functionality in HealthShare to verify NHS Number check digit.

We are trying to implement the NHS Number check digit validation using Modulus 11 Algorithm ( described here : NHS NUMBER (datadictionary.nhs.uk) ) 

I wanted to check if there is any built in option available or if anyone has implemented something similar using Object Script. 

Thank you for your help.  

Mary

3
0 397
Article Megumi Kakechi · Nov 23, 2023 1m read

InterSystems FAQ rubric

When executing OS commands, use $ZF(-100).

do$ZF(-100,"",program,args) // Execute the Windows command [synchronously].
do$ZF(-100,"/ASYNC",program,args) // Executes a Windows command [asynchronously].

When executing OS shell commands such as mkdir and copy, also specify /SHELL.

do$zf(-100,"/shell /async","mkdir","c:\temp\x")

Please refer to the following documents for details:

About $ZF(-100) [IRIS]
About $ZF(-100)

2
1 542
Question Michael Wood · Nov 28, 2023

I getting the response back to my method fine,

but it is not returning to my BPL.

What am I missing to get the response back to the BPL?

// Execute REST Call
set tHttpResponse=##class(%Net.HttpResponse).%New()
set tSC = ..Adapter.SendFormDataArray(.tHttpResponse,"POST",tHttpRequest,"","",tURL)
set tStatusCode = tHttpResponse.StatusCode
$$$TRACE("Status Code: ["_tStatusCode_"]")
do ..logJSON(tHttpResponse.Data.Read(),"Post Relation Response")

8
0 363
Question Emil Odobasic · Nov 27, 2023

Hello!
I am trying access each "name" tag in the xml-file down below and want to display them through the trace in the production:

<?xml version="1.0"?>
<staff>
  <doc type="consultant">
    <name first="David" last="Marston">Mr. Marston</name>
    <name first="David" last="Bertoni">Mr. Bertoni</name>
    <name first="Donald" last="Leslie">Mr. Leslie</name>
    <name first="Emily" last="Farmer">Ms. Farmer</name>
  </doc>

</staff>

2
0 527
Question Frederic Donnet-Monay · Nov 23, 2023

Hi,

I'm receiving in one of our interface a XML file as a %Stream.GlobalBinary, and in the source Application that produces this XML file, the user sometimes add a special character that force the XML file to have the header encoding to UTF-8, instead of ISO-8859-1 : 
<?xml version="1.0" encoding="UTF8"?> 

When my current interface tries to convert the %Stream.GlobalBinary into %XML.XPATH.Document to this exceptional UTF8 header encoding of the XML file : 

Set tSC=##class(%XML.XPATH.Document).CreateFromStream(stream,.tDoc)  --> contains exceptionally UTF8 encoding

6
0 743
Question Robert Cemper · Nov 20, 2023

While creating my latest examples for the JavaContest I faced the need
to communicate with my code from a program in IRIS to my Java code.

Communication with |CPIPE| worked as READ or WRITE  but not both?
In the Documentation Named PIPEs are explained rather shortly.
"Once open, a pipe acts like an ordinary device."  Not so precise.
I failed to achieve my expected READ/WRITE  as TCP would offer. 

Has anyone a working example to demonstrate it? 
Any suggestion is welcome.

I found a workaround for my actual case.
Though I'm not so happy with it.

4
0 481
Question Prasanth Annamreddy · Nov 20, 2023

I have received 2 errors while publishing Patient data to repository. Message viewer displays like below and the Application log found  bold content.

Could you please help me on this to resolve the errors.

An error occurred with the web application.
It has been logged to system error log (System Operation>System Logs>Application Error Log).

"<METHOD DOES NOT EXIST>OnPage+42^EnsPortal.MessageContents.1 *%Id,HS.FHIRServer.API.Data.Request : CSP Error"

Business Operation Event logs displays "ERROR <Ens>ErrRequestNotHandled: Request message '3@HS.FHIRServer.API.Data.Request' not handled"

6
0 723
Article Robert Cemper · Nov 19, 2023 1m read

Based on the successful solution for my 2nd contribution to the Contest 
I used an adapted version for this package. And have some findings I'd like to share.

Multiple communication steps over CPIPE may take time.
You won't recognize it on a fast machine. But a slower box with
Windows + Docker Desktop + your browser (and more) is neither
"Speedy Gonzales" nor a "Road Runner". 🙂

First observation you launch your OS command and see NO result
On the console, you just sit there and expect a reply.
Establishing the Connection to IRIS is a typical case.
Jour redirected Output is just empty.  

1
0 258
Question Luis Angel Pérez Ramos · Nov 14, 2023

Hi community members!

Recently a customer ask me about a problem that detected when they were trying to send a post call to an external HTTP service, this service has changed and now it redirects to another URL, so they have setted to true the FollowRedirect parameter (setted to false for POST calls by default), what is the problem? They are sending a custom header in the post call and after the redirection this value is deleted.

2
0 336
InterSystems Official Mark Hanson · Feb 27, 2023 2m read

I wanted to provide a heads up of an improvement in how we generate and call method code in IRIS 2023.1.

A class in IRIS is composed of two main runtime components:

  1. Class Descriptor - A highly optimized list of methods, properties, class parameters that make up the class along with attributes associated with each of these e.g. public/private setting.
  2. ObjectScript code - A set of routines that contain the ObjectScript code to be executed when a method is called.
10
3 1015
Article Steve Wilson · Nov 3, 2016 2m read

I was recently asked whether we have a function to convert LDAP date time stamps into $HOROLOG format or other formats and the answer is not at the moment, but there is a simple method to do the conversion.

Let us look at the facts and figures involved...

1) Active Directory's (AD) date 0 (zero) is 1601-01-01 00:00:00.000 or January 1st, 1601 at midnight (00:00:00)

2) AD timestamps are calculated as the number of 100 nanosecond intervals from date 0

3) 864000000000 is the number of 100 nanosecond intervals per day

1
0 1212
Question Pietro Di Leo · Nov 6, 2023

Hi everyone, 

today I'm asking your help with an issue related to the response messages sent from my production to a client software, such as Postman or SoapUI. 

Issue

In the last few days I've been unable to view the responses received from my production in Postman, even if I was able to do so earlier. I'm sending the request to a remote server reachable via a Putty tunnel.

Postman Test

I'm currently testing this simple POST message: 

1
0 1076
Article David Hockenbroch · Nov 2, 2023 9m read

Here in %SYS, we have already examined users, resources, and roles. Now that we know how to set all of that up, we should give it a purpose. Next we will talk about applications! As you may expect, we will see various identical class methods defined here that we have seen in the previous classes. However, some of them will have some tiny yet significant differences.

1
3 522
Question Robert Steed · Oct 23, 2023

This applies to embedded and dynamic SQL queries in Caché ObjectScript. If I attempt to terminate the process via Management Portal, nothing happens. Neither does Ctrl C nor closing the terminal window in which my program is running, nor setting a stop flag in a global which is read by the program on each loop iteration. The only way to stop the query appears to be restarting the Caché server (which is running locally on my PC).

6
0 773