#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 Jeffrey Drumm · Feb 8, 2022

Is there a straightforward workflow in VS Code for moving a class from one namespace to another on the same server? With Caché/IRIS Studio, it was a (sort of) simple export/change namespace in file menu/import operation. But in VS Code it's not obvious (to me, at least). 

I can add multiple namespaces to a workspace, but when using isfs:// paths I see only a "Download" option and no "Upload" or "Import/Compile." When I'm navigating the local file tree, I see Import options, but no way to select the namespace into which I want to import.

8
0 1978
Question phillip jack · Feb 2, 2022

Hi Folks,

I created a persistent class as below 

Class myclass.DataBase Extends %Persistent
{

Property ID As %String;

Property Skill As list Of myclass.SerialTablelist;
}

and Created another Serial class as 

Class myclass.SerialTablelist Extends %SerialObject
{

Property PSkill As %String;

Property OSkill As %String;
}

Now I will save the id as below

do rs.Prepare("Insert into myclass.DataBase(ID)VALUES(?)")
do rs.Execute(ID)

 

I am facing issue with the AS LIST OF 

Could any one guide me how to save the Skill (PSkill ,OSkill ) using resultset (I am able to )

12
1 583
Announcement Derek Robinson · Feb 4, 2022

Hi all - we just released the first episode of Season 2 for our Data Points podcast by Learning Services. This episode features a conversation with @Bob Kuszewski about Embedded Python. If you're a Python developer, or if you're simply interested in the functionality, check it out! For more information, head over to https://datapoints.intersystems.com.

0
1 289
Question Timothy Leavitt · Feb 2, 2022

I'm trying to write a method that runs an OS command with $zf(-100,"/ASYNC") and then waits for it to finish before returning, but I can't figure out how to check if the child process (in $zchild) is still running. $System.Process.State($zchild) always returns "RUN" even once the child process is gone. Is there some better way to check this, short of running another OS-specific command and processing the output (which is just really annoying and unelegant)?

8
0 595
Question Stefan Cronje · Feb 1, 2022

Hi,

I am using VSCode together with IRIS 2021.1.
When using Shift+Alt+F to reformat a class file, it pops up with the below message. When I select install formatter, it routes me to the extensions page, where it shows the extensions as being installed. Any advice will be appreciated.

 

8
0 1606
Article Jose-Tomas Salvador · Nov 9, 2021 3m read

For some years I missed being able to offer, to everybody interested in ObjectScript, a tutorial more or less complete, to start with ObjectScript. Something that could help more and make things easier to those new developers that come to our technology... something intermediate, halfway between the common "Hello World!", that doesn't really get you further, and the "Advanced Training", that is unaffordable because of lack of time,etc.

If there were something truly helpful not only as an introduction to the ecosystem, but as a starting point, as a boost, to really start to walk into ObjectScript and move forward by yourself... wouldn't that be awesome?

7
1 870
Question Justin Richter · Jan 3, 2022

So I've been reviewing a lot of questions posted in the InterSystems community regarding NULL properties in JSON. I've also been reviewing the JSON documentation. None of these things have been able to help me so far.

1. We don't seem to have the %JSON.Adaptor class available for us to use in our system.

2. I'm not really confident enough to create JSON Type classes or backporting code, etc.

2
0 839
Article Semion Makarov · Jan 4, 2022 2m read

Hi Devs!

Recently, I needed to create templates for newsletters.
I couldn't find any tools, so I decided to use the CSP (Caché Server Pages) to build the templates.

Let's figure out how to make a newsletter similar to Weekly OEX Digest.


Weekly OEX Digest

There are strict requirements for HTML email messages.
Basic requirements:

  1. The page should be static;
  2. You have to use inline styles for mailer compatibility (so much code);
  3. Use custom fonts, some images, etc., is not allowed
0
0 614
Article Yuri Marx · Nov 25, 2021 3m read

The XData (https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_XDATA) is a powerful feature to set documentation and metadata information for classes and methods. The %CSP.REST class uses XDATA to mapping REST calls (https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GREST_csprest), so in this article you will see how to use XData into your apps as code, not only as documentation.

4
1 649
Question Andy Stobirski · Dec 29, 2021

Hi

I'm using a class which extends %XML.Adaptor adaptor and I want to create an XML file with multiple namespaces, like the following:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
</soap>

However, I don't see how to do this with the code I have. So far, I have

2
0 675
Announcement Anastasia Dyubaylo · Dec 28, 2021

Hey Developers,

Thanks to everyone for participating in the Advent of Code 2021and coding in InterSystems ObjectScript! We're pleased to introduce the winners and distribute all the prizes! 

Big applause goes to these developers: 

   @Kevin An (w/ repo)

   @Yuval Golan (w/ repo)

   @Oliver Wilms (w/ repo)

We'd also like to reward another developer who conquered Embedded Python and made all 25 challenges on it. Please welcome:

   @Robert Cemper (w/ repo)

6
0 432
Article Vivian Lee · Dec 15, 2021 3m read

Setting the Scene

I was editing the properties of a persistent ObjectScript class the other day and noticed that the storage definition wasn't updating to reflect my latest changes.

In this case, I deleted a property that was no longer needed from the class definition, saved, recompiled, and still saw it in the storage definition.

No problem, I thought. If the storage definition gets autogenerated on compile, I can just delete it and recompile the class. Sure enough, after doing this, I no longer saw the deleted property in the storage definition.

There, problem solved... right?

7
5 890
Question Matthew Giesmann · Dec 16, 2021

I have an auditing class that defines some sqlComputed properties and can be extended by other persistent classes to enable auditing of its properties.  

Class Audit.ModifiedTracker [ abstract ] {
/// Last time this record was saved
Property LastModifiedTime As %TimeStamp [ SqlComputeCode = {Set {*}=$zdt($zts,3)}, SqlComputed, SqlComputeOnChange = ("%%INSERT", "%%UPDATE") ]; 
/// User responsible for modifying record
Property LastModifiedUser As %String [ SqlComputeCode = {set {*} = ..GetModifiedUser()}, SqlComputed, SqlComputeOnChange = ("%%INSERT", "%%UPDATE") ];
3
1 345
Question Evgeny Shvarov · Dec 10, 2021

Hi folks!

I'm curious if it is possible to change the class method to another class?

I call a method of a system class  to generate another class. But there is a bug/feature in a library class, so I need to tweak a bit the generated method, e.g. add additional parameter and change the line to "if" the parameter.

I hope to do this programmatically after class generation and change the code in a way I like.

What are the options?

7
3 679
Question Nicola Sartore · Dec 2, 2021

I need to store an equivalent of the SNN (Social Security number). I need it to be encrypted and I'll have to be able to search for it once stored.

For what I've seen my options are: 

- SHAHash from the %system.encryption library. Simple and easy to implement. My question is, might collisions be a problem? We are talking about a 10 millions entry.

- AES encryption. In this case I'd like to know if there is a standard way for key management in the InterSystems environment.

I can eventually get a certificate for this project to use other encryption function as well.

Open to suggestions.

2
0 409
Question Vivian Lee · Nov 18, 2021

Hi Dev Community,

I have a persistent Document class that has a FileName string property and another Question class that has an optional one-to-many relationship with Document.

I'm trying to add a SqlComputed property to the Question class (docFileName) where docFileName = Document.FileName if there is a related Document or an empty string if there isn't one. 

I'd prefer the property to be SqlComputed so that if Question.Document changes, Question.docFileName will automatically update.

Does anyone know the syntax for accessing the properties of a related object in the SqlComputeCode?

Thanks!

12
0 692
Question Ben Webb · Dec 2, 2021

Hi all, I'm trying to output a XML file, mapped from a ORU_R01 2.3 HL7 message, with a file name based of fields in the source HL7 message in the following format, source.{PIDgrpgrp(1).PIDgrp.PID:PatientIDInternalID(1).ID}_"-"_source.{PIDgrpgrp(1).PIDgrp.PV1grp.PV1:VisitNumber.ID}_"-"_source.{PIDgrpgrp(1).ORCgrp(1).OBR:ObservationDateTime.timeofanevent}To give something like RXR0000000-000000123-20211125105415.xml as the output filename,I initially tried to extend the EnsLib.XML.Object.Operation.FileOperation class and overwrite the OnMessage() method to allow me to specify the filename but I

1
0 441