#ObjectScript

0 Followers · 1.5K 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 Ashok Kumar T · Jan 8

I tried executing the SQL JSON_TABLE query with large JSON string(more than 200000 characters) and I got the below error. I'm curious about this under the hood workflow and how does it reach reaches MAXSTRING.

ERROR #5002: ObjectScript error: <MAXSTRING>CompileRtns+295^%occRoutine > ERROR #5030: An error occurred while compiling class '%sqlcq.LEARNING.cls247'

 Thanks!

0
0 0
Question Oleksandr Kyrylov · Jan 8

Hello, community.

I have a problem with running a SQL query on a linked MySQL table.

The connection works fine, but the following query throws an error:

SELECT   TOP 10 * FROM   linkedinternal_test.persons

 [SQLCODE: <-400>:<Fatal error occurred>]

  [%msg: <Remote JDBC error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '10 T1.PersonID AS C1,T1.LastName AS C2,T1.FirstName AS C3,T1.Address AS C4,T1.Ci' at line 1. >]

Linked table class:

0
0 0
Article Chris Stewart · Jan 17, 2024 9m read

The Lo-Code Challenge

Imagine the scene.  You are working happily at Widgets Direct, the internet's premier retailer of Widgets and Widget Accessories.   Your boss has some devastating news, some customers might not be fully happy with their widgets, and we need a helpdesk application to track these complaints.   To makes things interesting, he wants this with a very small code footprint and challenges you to deliver an application in less than 150 lines of code using InterSystems IRIS.  Is this even possible?

8
6 909
Article John Murray · Sep 21, 2023 1m read

Earlier this year I announced availability of a VS Code extension for coding in ObjectScript, Embedded Python or SQL using the notebook paradigm popularized by Jupyter. Today I published a maintenance release to correct a "getting started" problem.

Here's a video of the installation steps from the extension's README:

(video superseded by an update in a later comment)

Why not try it for yourself?

3
0 408
Article Jani Hurskainen · Dec 31, 2024 6m read

You'll find the original text and all my Advent of Code efforts in different programming languages in https://bitbucket.org/janihur/advent-of-code/src/master/

ObjectScript code discussed here is found in https://bitbucket.org/janihur/advent-of-code/src/master/objectscript

I have been using ObjectScript only on last 1,5 years maybe 30% of my working time but the code at work is very different than in these puzzles. You can find my random code snippets and learning notes from https://github.com/janihur/objectscript-ex

0
0 0
Article Kate Lau · Dec 31, 2024 8m read

Last Chapter: Creating a REST client to get Tracks from Spotify REST API - Part3 Get some data (e.g. Artists)

Git link: https://github.com/ecelg/InterSystems-IRIS-as-a-Spotify-REST-client

OK we create a method to get data and lets try to get some Tracks 😁

Now open a terminal and test the code

Run the following line

w ##class(rest.utli.requestUtli).getdata("Spotify","/search","offset=5&limit=10&query=Shape%20of%20you&type=track&market=SG")

ooooo no seems there is huge among of data returns.....😥

I would like to know what information can be found in 1 track....🤔 how about only query 1 track?

0
0 0
Announcement John Murray · Dec 16, 2024

The InterSystems platforms have always offered dynamic documentation of the packages and classes in a namespace, a feature known informally as Documatic. But what if you need to publish this class reference information on a website without requiring the site to be connected to an IRIS server containing the actual classes?

0
0 0
Question Ali Chaib · Dec 19, 2024

Every time I try to update an SQL table using odbc connection, I'm getting: ERROR <Ens>ErrException: <MAX $ZF STRING>zPrepareW+1^%Library.SQLGatewayConnection.1

Set sqlStatement = "UPDATE dbo.Table1 SET OriginalMessageText="_OriginalMessageText_"WHERE Id='"_Id_"'"
$$$TRACE("SQL Statement: "_sqlStatement)

I know that the problem is with the length of the ORU HL7 message  (that contains OBX base64 PDF file ) I'm trying to update in the table, but is there a way to fix this? other than truncating the message ?

I also tried this statement but it didn't work as well

0
0 0
Question Lee Butcher · Nov 28, 2024

I'm trying to project a series of objects and nested objects to XML, and I'm having difficulties getting the XML representation exactly the way I need it to be. Here's what I'm working with, nothing complicated:

Class XMLTest Extends (%RegisteredObject, %XML.Adaptor)
{
    Property Id As Id;
}

Class Id Extends (%RegisteredObject, %XML.Adaptor)
{
    Property Value As%String (XMLPROJECTION = "attribute");
}

By default it seem closing tags are used with all elements, as such:

<XMLTest><IdValue="D1949EE1-7D03-4666-9548-D1A949E10327"></Id></XMLTest>
0
0 0
Question Dmitrij Vladimirov · Nov 22, 2024

Hence the question: is there a way to do that?
The goal is to get data (from half a thousand to 3-4 thousands lines) from DB, calculate standart deviation  then use it as logical condition in analyzer. 
For example IF std > custom_value = show_the_result ELSE null
There is a STDDEV(MDX) method  used in Analyzer but it is a measure and it can not be used as logical condition (correct me if i am wrong)

0
0 0
Article David Hockenbroch · Nov 5, 2024 7m read

As we keep updating our software, we often realize that we require more and more modern solutions. So far, only one major piece of our software relies on reading barcodes in documents and images. Since Cache did not have a means of reading barcodes in the past, we have always achieved our goals by using a Visual Basic 6 application. However, it is no longer an ideal solution because it is currently complicated to maintain it. IRIS also lacks this capability, but it has recently got an option that makes up for it: embedded Python!

0
0 0
Question Lee Butcher · Nov 11, 2024

I have a business process that adds data to a global variable on receipt of an HL7 message, and a scheduled task that executes a class method defined within the same business process that removes data from the same global variable. With this in mind it makes sense to consider concurrency and therefore make use of the LOCK command.

My first question is whether this is actually necessary?

0
0 0
Question Anthony Master · Nov 8, 2024

Throughout the forum, I find examples of using the method getSegmentByIndex to get the segment as I loop through the HL7 message segments.

Today I spent way too long trying to figure out why I could not modify the segment with this same method. I reached out to my more experienced team and I showed where I got the base code from what I was doing, but I myself could not find the documentation of the method.

After some time, we stumbled upon the GetMutableSegmentAt and GetSegmentAt methods and plugged the mutable method in its place and what do you know, it worked!

0
0 0
Question Scott Roth · Oct 28, 2024

Our TEST environment and PROD environment are on two different versions of HealthShare Health Connect.

TEST IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2024.1 (Build 267_2U) Tue Apr 30 2024 16:06:39 EDT [HealthConnect:7.2.0-1.r1]
PROD IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2022.1.4 (Build 812_0_22913U) Thu Dec 7 2023 17:06:30 EST [HealthConnect:3.5.0-1.m1] [HealthConnect:3.5.0-1.m1]

Someone within the group wants to migrate a BP from TEST to PROD, however they are running into an error "attribute 'languageOverride' is not declared for element 'assign'" 

0
0 0
Article Timothy Leavitt · Oct 28, 2024 2m read

User-defined aggregate functions have been supported in IRIS since 2021.1.0. I'd wished upon a star for these years ago before finding a secret hacky way to override MAX and MIN in a custom datatype, but didn't get a chance to actually try one out until today. I thought it was an interesting experience/example - the question of how to get a Median in IRIS SQL came up once before - so I'm sharing it here without too much further comment.

0
0 0
Question Chris Lambert · Oct 17, 2024

Hello,

I'm trying to carry a custom error from one business process to another.

BPL:LookupClass fails it's lookup and a custom error of "Lookup XYZ" is generated.

The class quits with that error, but upon quitting, the custom error gets wrapped in an Ensemble System error: 

ERROR <Ens>ErrBPTerminated: Terminating BP LookupClass # due to error: Lookup XYZ

This means, when I use the %LastError property to get the error message, it's not got the value I want to use. In this case, "Lookup XYZ". It instead has "Terminating BP LookupClass # due to error: Lookup XYZ"

0
0 0
Article David Hockenbroch · Oct 14, 2024 9m read

Many programming languages use the try-and-catch construct to handle runtime errors gracefully. If the code within the try block encounters an error, it will throw an exception to the catch block, where the error handling occurs. Today we will dive into the ObjectScript implementation of this construct and discuss some ways to clean things up.

ObjectScript Implementation Basics

To get started, we will first look at the basic structure of the try/catch block:

try{
    //some code here
}
catch ex{
    //some error handling here
}
0
0 0
Article Robert Cemper · Mar 21, 2024 2m read

In ObjectScript you have a wide collection of functions that return some value
typically:

set variable = $somefunction(param1,param2, ...)

There is nothing special about that.
But there is a set of functions that I classify as LEFT SIDED 
The specialty of them is that you can use them also on the left of the equal operator 
as a target in the SET command:

set $somefunction(param1,param2, ...) = value

The reason to raise that subject is that with IRIS 2024.1 there is after may years  a "new kid on this block"

$VECTOR()

0
0 279
Article Evgeny Shvarov · Apr 22, 2024 3m read

Hi folks!

Often, when we develop commercial solutions, there is a necessity to deploy solutions without source code, e.g., in order to preserve the IP.

One of the ways how this can be achieved is to use InterSystems Package Manager.

Here I asked Midjourney to paint an intellectual property of software:

How this can be achieved with IPM?

In fact, this is very simple; just add the Deploy="true" clause in the Resource element in your module.xml manifest. Documentation.

0
0 356
Article Muhammad Waseem · Sep 23, 2024 4m read

Hi Community,
In this article, I will introduce my application iris-DataViz
iris-DataViz is an Exploratory Data Analysis and Visualization Streamlit Application that leverages the functionality of IRIS embedded python and SQLAlchemy to interact with IRIS, as well as the PyGWalker python library for data analysis and data Visualization. PyGWalker (Python Graphic Walker) is an interactive data visualization library built for Python, aiming to bring the ease and functionality of Tableau-style drag-and-drop visualization into Python environments.


Application Features 

0
0 0
Question Alin Soare · Sep 26, 2024

Hi,

I tried to create what is know as a "class variable".  As far as I understand the only analogy to class variables would be the "class parameters".

I tried to use a class parameter but I cannot change its value at runtime.

Parameter STATUSES = {{}};

Property repr As %String;

Method %OnNew(repr) As %Status
{
    w ##class(Test...).#STATUSES
    w ..#STATUSES

    ...

}

When I get ..#STATUSES, it is a string like "5@%Library.DynamicObject". This is a string, not a pointer to an object.

I tried to define STATUSES as Parameter STATUSES  As CONFIGVALUE = {{}};  and change the value with  

0
0 0
Question Davidson Espindola · Oct 6, 2024

Good morning, everyone

I purchased an HP LaserJet M101-M106 printer, and I'm trying to print via the Windows cache device, but I can't get it to work.
I can send it, but it doesn't print.
Physical device name: |PRN|HP LaserJet M101-M106
Type: Other
Subtype: P-DEC
Open Parameters: “W”

Could someone help me with what might be happening?

Otherwise, thanks

Davidson

0
0 0