#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 Craig Regester · Jun 17, 2020

Good day all -

I am attempting to use the Data Transformation Builder (for ease of use for my other engineers) to build up a web service request object to send to an outbound operation. The source is a custom persistent class (extends Ens.Response, %JSON.Adaptor) and has serialized sub-class data elements and the request object is a custom persistent class (extends Ens.Request, %JSON.Adaptor.)

When attempting to use a for each on one of the serialized properties of the source object, the for each works (source.

5
0 652
Question Jonathan Anglin · Jun 18, 2020

I have a code tag that performs some logic in a DTL, and want to add to it the ability to find the number of substrings delimited by a dollar sign ($) within a particular string. I have tried the following which compiles just fine, but generates an error when testing in the Data Transformation Builder.

set lineCount = $DCOUNT(reportBody,"$")

ERROR <Ens>ErrException: <SUBSCRIPT>zTransform+985^LH.IAMON.IAMONORU1XsformDTC2.1 *DCOUNT() Encoded subscript 1 > 511 bytes -- logged as '-' number - @' set lineCount = DCOUNT(reportBody,"$")'

3
0 958
Question Salma Sarwar · Jun 12, 2020

Hi

 

I was experiencing an issue yesterday where I had over 900 messages in the queue. I had to filter and delete only A31 messages out of the queue allowing the rest of them to be processed.  I tried to use SQL to set the status of the message to 'Suspended' however the A31 messages still remained on the queue and I had to suspend manually by going through each message.  Is there a way of Suspending or Aborting only certain type of messages in a queue.

2
0 1334
Question Tim Miller · Jun 9, 2020

So we have a custom business service that we use and we are calling SendRequestSync.

Set tSC=..SendRequestSync(tOneTarget,tTargetStream, .tResponse)

For our response from our custom business operation, we send back an Ens.StringResponse.

set pResponse = ##class(Ens.StringResponse).%New()
set pResponse.StringValue = "File Delivery: "_tOutFilename_" of size: "_pRequest.Stream.Size_" (modified='"_pRequest.Stream.LastModified_"')"_" Status: "_tSC
 

So now we are trying to use Rules to pass the the messages to certain destinations with a normal business process of EnsLib.

3
2 632
Question Ting Wang · Jun 12, 2020

Hi Everyone,

We are trying to migrate old server to new infrastructure and need to sync all the DTL cls from old one to new one. There are hundreds of DTL in system and we tried to export from production but cannot select all at once which might cause some missing classes. Not able to connect to studio or atelier with that server neither. Is there any way that we are able to do mass export from system which will save some effort? Please let me know your thoughts. Thanks.

3
0 286
Article Evgeny Shvarov · Jun 12, 2020 3m read

Hi Devs!

Last weekend I had been testing the newborn csvgen module and was looking for a CSV file to test - thus I came across an interesting datafile on Data.World  with Game of Throne episodes statistics. Death statistics. These folks documented all the murders through all the 8 seasons and noted where, who, from what clan with what weapon had killed another one.

So I imported it and made an IRIS Analytics dashboard.

You Know Nothing, Jon Snow | You Know Nothing, Jon Snow | Know ...

Don't worry, Jon,  with this dashboard we can figure out something ). See the details below.

0
2 815
Question Olivier Champion · May 20, 2018

Hi

on this code

set reader=##class(%XML.Reader).%New()
    set statuscode=reader.OpenFile(file)
    if $$$ISERR(statuscode) {do $System.Status.DisplayError(statuscode) quit $$$NULLOREF}

I got this error "unable to open file 'https://www.musicxml.org/dtds/partwise.dtd'"

or using the xml schema wisard i got the error  https is active but no configuration found.

where do I have configure it?

5
0 504
Question Scott Roth · Jun 9, 2020

After all these years of doing basic Ensemble work, I am just beginning to venture into using Cache Tables instead of either Data Lookup tables, or what I know of Outside SQL tables using JDBC.  I have several Cache SQL tables that I am building for a project I am working on.  

  • I was wondering if it was possible to use a SQL call to look up a value against a Cache SQL table  within a Business Rule? 
  • Or is this something that I would have to build a custom function for?
9
0 527
Question Stuart Byrne · Jun 4, 2020

Dear All, 

I am currently working on a project to record ORU^R01 into a global for a particular set of tests.

I have multiple OBX repeats that need to go into a specific fields withing one row/ record on the global.

I am having trouble finding a way to either count or loop though the OBX's correctly in ObjectScript often with the counter being undefined.

I have done this this way, as I am building upon an existing class to populate this global.

The latest iteration of my obx looping code is below:

            

// handle repeating obx's by setting count of value    
            set segcnt = pMsg.
8
0 1605
Article Bernd Mueller · Jan 30, 2018 13m read

Some time ago I got a WRC case transferred where a customer asks for the availability of a raw DEFLATE compression/decompression function built-in Caché.

When we talk about DEFLATE we need to talk about Zlib as well, since Zlib is the de-facto standard free compression/decompression library developed in the mid-90s.

Zlib works on particular DEFLATE compression/decompression algorithm and the idea of encapsulation within a wrapper (gzip, zlib, etc.).
https://en.wikipedia.

6
2 2842
Announcement Anastasia Dyubaylo · Jun 1, 2020

Hi Community!

This week is a voting week for the InterSystems IRIS Native API Programming Contest! We have 8 applications — so you have a set of applications to choose from!

 

How to vote? This is easy: you will have one vote, and your vote goes either in Experts Nomination or in Community Nomination.

5
1 419
Question Arto Alatalo · Apr 29, 2020

Hi Community! I need your advice.

The method below is 6 times slower on production server than on developing machine:

ClassMethod runme4()
{
    s cnt=615210
    s st=$zh
    for i=1:1:cnt {
        s p=##class(digi.packet).%OpenId("packet||5237")
        w:p="" "not found",!
        k p
    }
    w $zh-st,!
}

BUT the server is 6 times faster if OpenId replaced with simple read of a large global (s p=^someLargeGlobal). Any ideas what makes OpenId so slow only on the server?

    And another question: I wanted to profile the code with  %Monitor.System.

    27
    0 1244
    Article alex kosinets · Feb 24, 2020 2m read

    In MX any global can be displayed on a sheet in the form of a table.

    We will look at the simplest example (work only with  CACHE-2014+ or IRIS)

    Upgrade or install  MX.

    Start mx.xlsb  and connect to your namespase with vmx-routines.

    After opening first sheet, click button  []   ##class(SYS.Stats.Dashboard).Sample()

    Then press button [design-mode]   (top of screen ).

    You will see something like this in the top four lines:

    M-Formulas works in cells in the process of opening this sheet,  step by step :

    • - go to the namespace %SYS    ( zn “%SYS” )
    • - set dashboard=##class(SYS.Stats.Dashboard).
    5
    0 658
    Question Colin Parker · May 26, 2020

    I am using the Java Binding to connect a Java Middleware Application to Cache.  Originally I was using a CacheListOfDataTypes (JAVATYPE = "java.lang.List") object to bring data back.  I was tasked with encrypting the data using AES and I was using the AESCBCEncrypt function on the List elements (up to 20k characters for each element) to bring it back before concatenating it on the middleware.  This almost worked.  Like 95% of the characters were being decrypted correctly but some text was coming back garbled.  I couldn't understand how this was happening.

    3
    1 597
    Announcement Anastasia Dyubaylo · May 19, 2020

    Hi Community!

    We are glad to invite every developer who uses ObjectSript and VSCode plugin to the second webinar hold by the VSCode ObjectScript plugin developer on May 26  at 11:00 EDT. 

    You will learn how to develop InterSystems IRIS solutions using GitHub Development Flow with VSCode ObjectScript and Docker.

    Speaker: @Dmitry Maslennikov, InterSystems Developers Advocate, CTO at CaretDev.

    6
    1 787
    Question Daniel Lee · May 26, 2020

    I have a class method that accepts a global parameter but when I attempt to order this global, the global name is listed as undefined. I can execute $DATA(pGlobalName) successfully.

    ClassMethod ExamineGlobal(pGlobalName As %Global)
     {
        set gStatus=$DATA(pGlobalName) ; returns 1 
        write "This is the global name: "_pGlobalName
        set gmin=$ORDER(pGlobalName("")) ; here pGlobalName is undefined
     }

    In debug mode, data returns 1 for a valid global with no descendants. This is expected.

    However, when I call $ORDER, it shows <UNDEFINED> for pGlobalName.

    3
    0 392
    Article Evgeny Shvarov · May 25, 2020 2m read

    Hi ObjectScript developers!

    How to Protect Your Belongings from Pests While Moving - Delicate ...

    InterSystems ObjectScript is perhaps the best language on the planet to deal with globals - and it is an interpretable language.

    Yes, it has a compiler. But even the compiler can compile some lines in ObjectScript which will then fire as bugs during the runtime.

    There are some technics on how to avoid that such as unit testing, coding guidelines and your coding experience, of course ;)

    Here I want to present to you the yet another approach to how you can reduce the number of errors in your ObjectScript runtime and enforce coding guidelines - it's an ObjectScript Quality tool developed by Lite Solutions, InterSystems solution partner.

    See the details below.

    0
    0 520
    Question Yone Moreno · May 19, 2020

    Hello,

     

    We are trying to connect to a database through a JavaGateway.

     

    We observe that the JavaGateway reports:

    Failed to start the Java Gateway server: ERROR #5002: Error de cache: <UNDEFINED>zGetJavaVersion+22^%Net.Remote.Service.1 *versionWithPrefix

     

    We have checked that we do have the Java Home set:

    /usr/java/jdk1.8.0_65

     

    And we have seen the java files in the server:

     

    We have read the code where the exceptions being raised:

     

    /// Returns the numeric part of the Java version string (e.g. 1.8.0.1)
    /// Rules of how the complete version string is formatted can be found here:
    /// http://www.oracle.

    2
    0 740
    Question Laura Cavanaugh · May 11, 2020

    Hello all, I have a question about constucting thousands of clones, and scope.

    In my code, I'm looping through a database, say 200k+ objects, and creating a clone of each object (we need to evaluate a modified clone of the object, but not account for what's on disk).  

    I see this a lot in the documentation:

    Whenever you set a variable or object property to refer to a object, its reference count is automatically incremented. When a variable stops referring to an object (if it goes out of scope, is killed, or is set to a new value), the reference count for that object is decremented.

    7
    0 850
    Announcement Anastasia Dyubaylo · May 8, 2020

    Hi Community,

    We're pleased to invite you to join the upcoming InterSystems IRIS 2020.1 Tech Talk: Integrated Development Environments on May 19 at 10:00 AM EDT!

    In this edition of InterSystems IRIS 2020.1 Tech Talks, we put the spotlight on Integrated Development Environments (IDEs). We'll talk about InterSystems latest initiative with the open source ObjectScript extension to Visual Studio Code, discussing what workflows are particularly suited to this IDE, how development, support, and enhancement requests will work in an open source ecosystem, and more. 

     

    1
    0 493
    Discussion Murillo Braga · May 13, 2020

    Hello guys, 

    I have used the Studio SOAP wizard to generate some webservice client classes and amongst those classes:

    Class RMH.SOAP.s0.Output Extends (%Persistent, %XML.Adaptor) [ ProcedureBlock, SqlTableName = _Output ] {
    ...
    Property Value As %GlobalCharacterStream(XMLNAME = "Value");

    And the caller looks like

    Class RMH.SOAP.SoapTreeSoap Extends %SOAP.WebClient [ ProcedureBlock ] {
    ...
    Method Run...(Tree As %String, Inputs As %String, Debug As %Integer) As RMH.
    3
    1 627
    Article Evgeny Shvarov · Nov 21, 2019 7m read

    Hi Developers!

    As discussed in previous parts of Package Manager stories to turn your IRIS application into a deployable package you just need to introduce the module.xml file into the root folder of the repository and describe all the resources.

    I’m pleased to introduce you to a new project template on Open Exchange which contains examples of how to make different types of resources of your InterSystems IRIS application a part of the ObjectScript package and so make the deployable ObjectSctipt package.

    Let's see how you can describe your application resources using this template project as an example.

    See the details below.

    2
    7 686
    Article Robert Cemper · May 14, 2020 3m read

    Using the IRIS native API for Node.JS was the opportunity to present
    a MicroService operating in a Docker container.
    A demo video is now also available to watch the demo in operation.

    Instead of a utility you call directly on your IRIS host you now send a work-packages
    to the MicroService as would typically do with System Interoperability (aka.ENSEMBLE):
    of course, you have the option of more than one WebSocket Server.
    Once the WebSocket Client Service has done its job you get back the result from it.

    0
    1 1249