#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 Danny Wijnschenk · Jul 19, 2022 4m read

Mixing Object syntax with SQL is one of the nice features in Object Script. But in one case, it gave strange results, so I decided to isolate the case and describe it here.

Let's say you need to write a classmethod that updates a single property on disk. Usually, i would write that using SQL like this :

ClassMethod ActivateSQL(customerId) as %Status
{
   &sql(Update Test.Customer Set Active=1 Where ID=:customerId)
   If SQLCODE'=0 {
      Set exception = ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE, $Get(%msg))
      Quit exception.AsStatus()
   } Else {
      Quit $$$OK
   }
}
 

and call

5
0 424
Article Rizmaan Marikar · Dec 25, 2021 13m read

There are many ways to generate excel files using Intersystems, some of them are ZEN reports, IRIS reports ( Logi reports or formally known as JReports), or we can use third party Java libraries, the possibilities are almost endless.

But, what if you want to create a simple spreadsheet with only Caché ObjectScript? (no third party applications)

In my case i need to generate reports that contains large raw data (the financial guys love them), but my ZEN/IRIS fails, gives me, what i would like to call  a "zero byte file", basically says java ran out of memory, and causes heavy load on the repo






15
10 2305
Question Dominic Chui · Jul 14, 2022

Let's say I have two lists of connected data where elements of listTwo only make sense if given an item of listOne as context:

listOne = ["A", "B", "C"]

listTwo = ["x", "y", "z"]

Tuples like ("A", "y") and ("C, "x") make sense, but "A" or "x" by themselves don't. I would like to pass in a list of such tuples into a method and have it handle each tuple in the list. So what would be the best way to format them given that ObjectScript does not have specialized tuples? Would it be nested $LISTBUILD lists or something else?

1
0 370
Question Ramesh Ramachandran · Jul 1, 2022

Is it a good practice to set the MAXLEN value of %Library.String property type?  Will it lead to wasted storage if its not really using it?

For example, I have to store a 5 characters long string into the below str field. Which of the statement is recommended? 

Property str As %String;

vs

Property str As %String(MAXLEN="5");

2
0 2082
Question Yakov Berger · Feb 11, 2020

Hi,

I am using IRIS for Windows (x86-64) 2019.1.1

I have.

1. Created a BS with SQL Inbound Adapter which successfully connects and gets rows from DB .


2. Created a request message is populated with results of SQL query.

3  Created a BP with HL7 Router + Routing Rule + Transformation + Send to Target (BO).

4 . Created BO sending HL7 to file.

i am getting the following error.

ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zOnRequest+1^EnsLib.MsgRouter.VDocRoutingEngine.1 *DocType,Test.SQLtoHL7Req -- logged as '-' number - @''

What am i missing

Thanks.

8
0 1083
Discussion Sergey Mikhailenko · Feb 21, 2021

Hi developers. I often miss the ZPM program on a clean system. Nothing complicated? Take and install. And in one line? Especially in a docker container. There is a solution. I'm very happy with it;) Maybe the line can be shortened?

set $namespace="%SYS", name="DefaultSSL" do:'##class(Security.SSLConfigs).Exists(name) ##class(Security.SSLConfigs).Create(name) set url="https://pm.community.intersystems.com/packages/zpm/latest/installer" Do ##class(%Net.URLParser).Parse(url,.comp) set ht = ##class(%Net.HttpRequest).%New(), ht.Server = comp("host"), ht.Port = 443, ht.Https=1, ht.SSLConfiguration=n
12
5 1464
Article Timothy Leavitt · Jan 21, 2022 7m read

@Ming Zhou asked a great question in https://community.intersystems.com/post/how-get-all-properties-defined-… and the answer sums up exactly why ObjectScript is my favorite.

When I'm first describing ObjectScript or IRIS to someone I always explain that you can write a class, compile it, get a table, and work with your data from an object or relational perspective - whichever is most natural. Either way, it's just a thin(ish) wrapper around super fast under-the-hood data structures called Globals, and you can use those too when you really need that extra burst of

11
6 2280
Question Tom Bruce · Jun 20, 2022

Hi, I tried the following exercise from the IRIS documentation. I updated the username, password and IP address, but receiving this error;

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. --->

I can use the same credentials and IP address to connect ok via VSCode to my local IRIS...

Any pointers much appreciated.

https://docs.intersystems.com/irisforhealth20211/csp/docbook/DocBook.UI…

To connect Visual S

3
0 439
Question Joseph Tsang · Jun 27, 2022

Has anyone here been successfully populating a %Persistent object from calling %LoadFromMemory() with a temp. global?

I have tried using Sample.Person in the SAMPLES namespace. It worked EXCEPT that I have no way to set the id into that Sample.Person objec.

SAMPLES>Merge array(1) = ^Sample.PersonD(1)
 
SAMPLES>Set obj = ##class(Sample.Person).%LoadFromMemory(1,.array)
 
SAMPLES>zw obj
obj=1@Sample.Person  ; <OREF>
+----------------- general information ---------------
|      oref value: 1
|      class name: Sample.Person
| reference count: 2
+----------------- attribute values ----
1
0 263
Question Jimmy Christian · May 18, 2022

Hello,

I want to access the HL7 Router settings from within the HL7 rule. Goal is to create a New class by extending "EnsLib.HL7.MsgRouter.RoutingEngine".

Then create a PARAMETER ProcessMessage which can be set to an integer value for the HL7 Router.

Create a Rule class and based on the value of this setting ProcessMessage
process/not process the messages.

Class XYZRules Extends Ens.Rule.Definition [ CompileAfter = CUSTOM.Util.Rules.FunctionSet ]
{Parameter RuleAssistClass = "EnsLib.HL7.MsgRouter.RuleAssist";XData RuleDefinition [ XMLNamespace = "http://www.intersystems.com/rule]
{
<r

15
0 558
Announcement Laurel James (GJS) · Jun 16, 2022

Only a few days to go until the Global Summit! George James Software will be on hand to talk about any projects you may have on the horizon, such as application development, data and platform migration, system integration, training, and support – we can work with you to find practical and maintainable solutions that support the growing needs of your organization. 

We're also running a User Group Session on Wednesday, July 22nd at 12pm. It's a great opportunity to find out more about our tools and ask us (and current users!) any questions. 

Look out for us in the Partner Pavilion, or email me a

0
0 230
Question Warren Oyco · Jun 13, 2022

Hi,

Any suggestion on how to compare dates? Below is my code but it does not seem to work.

USER>w $zdate(zdateh(x,8),1) > $zdate($zdateh(y,8),1)

When I set x to "06/01/2022" and set y to "04/01/2022" gives me an output of 1

When I set x to "09/01/2019" and set y to "04/1/2022" still gives me an output of 1

Any help is appreciated.

Thanks!

7
0 970
Question Tom Bruce · Jun 13, 2022

Hi, is there a method that can retrieve both the filename and archive path?

I can get the path to the file ok i.e. set sPath = pInput.Filename and I can get the archive path i.e. set tArchivePath = ..Adapter.ArchivePath

1
0 512
Question Peter Monteiro · Feb 9, 2022

For our WSDL the portType value is being suffixed with "Soap" at the end.

When i update the the SERVICENAME parameter. in the Service I can update the start of the portType value. Is there a way to prevent the suffix being added?

WSDL segment

<portType name="BillingDocumentRequestConfirmation_OutSoap">
<operation name="BillingDocumentRequestConfirmationOut">
<input message="s0:BillingDocumentRequestConfirmationOutSoapIn"/>
<output message="s0:BillingDocumentRequestConfirmationOutSoapOut"/>
</operation>
</portType>
<binding name="BillingDocumentRequestConfirmation_OutSoap" type="s0:Bil
3
0 438
InterSystems Official Raj Singh · May 2, 2022

This month I announce the release of version 1.8.0 of the VS Code extension, which contains the following enhancements and bug fixes.

The big news is support for server-side project files as some of you old-timers will remember from Studio. If you work client-side, VS Code already has great project management features. You can simply use a folder as a project, or use multi-root workspaces. But if you work server-side, you might appreciate some better artifact management capabilities, and that's what this feature is about. Read more in this new Projects chapter of the documentation.

Change Lo

3
1 514
Article Muhammad Waseem · May 30, 2022 3m read

Hi Community,

This post is a introduction of my open exchange iris-fhir-client application.

 iris-fhir-client can connect to any open FHIR Server by using embedded python with the help of fhirpy Library.
Get Resource information by terminal and by using CSP web application.

2
0 1025
Article Lorenzo Scalese · May 30, 2022 3m read

Hi Community,

Recently, I migrated a series of Objectscript repositories from XML to UDL format.
After the migration, I was a bit disappointed by the presentation on the GitLab web interface.

Since Objectscript syntax is supported by GitHub, I thought It would be also supported by GitLab. Unfortunately, the library used by GitLab to highlight the code does not have an extension to support Objectscript.

GitLab uses the library Rouge, which can highlight over 200 languages. This is a library written in Ruby (see the GitHub page), but Objectscript is not in the list.
So, I decided to develop an


1
2 631
Question Federico Raimondo · Jan 20, 2020

Hi everyone, 

I am currently performing a patient merge thorug ADT^40 HL7 messages. In order to do that, I am following this guide which I found on the ducumentation: http://10.41.11.210:57772/csp/docbook/DocBook.UI.Page.cls?KEY=HESUP_ch_IHE#HESUP_IHE_configuring_registry_PIX
My main issue regards the fact that I can't update the PatientID and the SourcePatientID of the HS_Registry.Document table of the prior patient, wheras, I find only the new anagraphic on the HS_Registry.Patient table.

To do that I have created a process in my BUS prodaction which create the MergePatietRequest to send to

1
0 1215
Article Robert Cemper · Mar 24, 2022 3m read

This package offers a utility to export an XLarge Global into a JSON object file and to show
or import it again. In a previous example, this all was processed in memory. But if this is a
large Global you may either experience <MAXSTRING> or an <STORE>  error
if the generated JSON structure exceeds available memory.
 


Academic refers to the structure created.

  • each node of the Global including the top node is represented as a JSON object
  • {"node":<node name>,"val":<value stored>,"sub":[<JSON array of subscript objects>]}
  • value and subscript are optional but one of them always exists for a val





sad

1
0 450
Article Timothy Leavitt · Mar 17, 2021 3m read

I ran into an interesting ObjectScript use case today with a general solution that I wanted to share.

Use case:

I have a JSON array (specifically, in my case, an array of issues from Jira) that I want to aggregate over a few fields - say, category, priority, and issue type. I then want to flatten the aggregates into a simple list with the total for each of the groups. Of course, for the aggregation, it makes sense to use a local array in the form:

agg(category, priority, type) = total

Such that for each record in the input array I can just:

Do $increment(agg(category, priority, type))

Bu

10
4 1211
Question Ephraim Malane · May 5, 2022

Hi All,

I have been given the following  xml  class file with objectscript code that has methods that I need for file conversions. These method implementations will do necessary conversions but I don't know how to add it to Iris studio and run it as a task or maybe if it must be  put  on any location and call each method from the terminal and even if so how do I then call it.

Please advise how to go about this.

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="IRIS" version="26" zv="IRIS for Windows (x86-64) 2020.1.1 (Build 408U)" ts="2022-02-01 16:19:05">
<Class name="User.Ready.C

6
0 330