#Code Snippet

0 Followers · 298 Posts

Code snippet is a programming term for a small region of re-usable source code, machine code, or text.

Question Thomas Haig · Apr 10, 2024

Have successfully installed the Intersystems ObjectScript Extension Pack (version last updated 2024-03-26) in VS Code version 1.88 and when creating a new Class (in a New File of type ObjectScript-class) I am presented only with the following snippets:


When watching the Intersystems training videos (I am fairly new to IS) I notice there are far more options provided. For example from the video "Creating a Custom HL7 V2 Search Table" the following snippets are presented:

0
0 151
Article Lorenzo Scalese · Nov 10, 2023 13m read

Hi, developers!

Currently, I'm working on a project that requires highly dynamic event management. In the context of the Java programming language, my first instinct should be to opt for the "Observer Pattern", which is an approach to managing interactions between objects by establishing a notification mechanism. It allows multiple observers to react to changes in the state of a subject autonomously, promoting code flexibility and modularity. If you are not familiar with this design pattern, check out Wikipedia to find more information about it.

2
3 830
Article David Hockenbroch · Jan 24, 2024 7m read

The ideal number of table permissions to assign for your users is zero. Permissions should be granted upon sign-in based on the application used for access. For web applications, we have a simple way of doing this by appointing application roles, matching roles, and required resources in the System Management Portal.

0
0 307
Question Yone Moreno · Jan 3, 2024

First of all, thanks for your help, and time reading this question.

Why, when we send a SOAP message from SoapUI to a SOAP service in a HealthShare environment called 'ESBCHUIMI,' it recognizes the 'Credenciales' header, which has 'usuario' and 'password' as properties. This class is a %SOAP.Header.

However, when we load the WSDL using the SOAP wizard from this SOAP Service to another HealthShare environment called ESBSSCC and send it from SoapUI to ESBSSCC, when it is being forwarded from ESBSSCC to ESBCHUIMI, the ESBCHUIMI's service outputs:

5
0 213
Article Jose Ruperez · Oct 11, 2016 4m read

Now, let’s say you can’t access the terminal or simply you just rather execute it from a web interface. In this article, I will show you how to execute terminal commands from a simple web page.

For example, in the image below you see how we execute $zv on a webpage:

This is mostly possible due to the XECUTE command in Caché ObjectSCript. This command takes a string as a parameter and tries to execute it. This is the command used from the webpage, to execute what is being passed from the left navigation menu.

7
0 32571
Article Pierre LaFay · Dec 18, 2023 1m read

If Iris does propose to create keys following a sequence, how can we obtain a sequential number in another context?

In my case, I automatically create care centers, and I want to set them a number like:

APP-DD-999

APP = Name of the application used by the center
DD = center department number
999: sequential number in the department
It is of course possible that centers will be created in competition, so this possible competition must be managed.

My first approach was to use a persistent class and create a new object to retrieve its id, but this involves creating as many classes as departments.

3
0 247
Question Yone Moreno · Nov 20, 2023

Hello,

First of all thanks for your time reading this doubt.

We have discovered the following behaviour. Inside a Router we have a roule which needs to filter out the ADT_A08 messages which have not OBXs.

The legacy system had this rule implemented:

(((Document.{OBX(1).SetIDOBX}<"1")||((Document.{EVN:EventReasonCode}!="COD")&&(Document.{EVN:EventReasonCode}!="FIN")))

However we have tested it and it does not filter out the ADT_A08 messages.

Is there any way to express inside a Rule, that we need to discard ADT_A08 messages which have not OBXs?

5
0 222
Question Yone Moreno · Nov 6, 2023

Good morning,

First of all we would like to thank you for your time reading, thinking and aswering this question.

We have been developing a Transformation to convert a source ORU_R01 to a target ORU_R01. For each OBX segment we need to check an if, and then, if it is true we just need to put this OBX and continue to the next iteration, otherwise, if it is false, we need to put (copy) the ORC + OBR + TQ1 before this OBX, and then put this OBX, and after that, the SPM.

4
0 276
Question Wesley West · Nov 15, 2023

I am trying to execute a program from within cache using a $zf call

S X=$ZF(-1,"C:\""Program Files (x86)""\Car-Part\Messaging\iCPM.exe")

For the sake of this post I changed it to open notepad

S X=$ZF(-1,"C:\Windows\notepad.exe")

If I call it directly from terminal notepad opens and all is happy.  

If I add it to a program we use to run certain tasks once an hour or even every 10 minutes it will fire off notepad but it will be in the background.

The messaging application we use will not work at all in the background and needs to be in the foreground.  

2
1 289
Question Yone Moreno · Oct 17, 2023

Hello,

First of all, thanks for your help, and time, reading this questions, and answering to this doubt.

We have the following use case: to convert a HL7 ER7 ORU_R01 v2.5 message, to a Ens.Request Message which represent it with a custom data structure (each segment is a group of Properties).

To be more precise, the target Ens.Request Message's structure looks like:

5
0 550
Question Yone Moreno · Oct 10, 2023

Hello,

First of all thanks for your time reading this post, and thanks for your help with your answers, thanks.

We have the following doubt: We need to create a REST Service in HealthShare, to process incoming calls with the following URL's format:

https://host:port/api/studies?patientId=11473564
 

To accomplish this task, we have previously read:

https://community.intersystems.com/post/advanced-url-mapping-rest

https://community.intersystems.com/post/how-do-i-process-querystring-pa…

https://community.intersystems.com/post/how-get-param-passed-get-rest-q…

9
0 456
Discussion Eduard Lebedyuk · Oct 20, 2023

Let's do a round of code golf! Last one was very popular!

The Chinese zodiac is a repeating cycle of 12 years, with each year being represented by an animal and an element that changes every 2 years.
The animals are: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog and Pig.
The elements are: Wood, Fire, Earth, Metal and Water.
Your task is to write a function that receives a year, and returns the element and the animal that year represent.
Let's use the year 1924 as start point, in the Chinese zodiac the element was Wood and the animal was Rat.

Input

2023

Output

"Water Rabbit"
7
0 593
Question Yone Moreno · Oct 23, 2023

Hello,
First of all thanks for your help.

We have developed a REST Operation. We wonder how could we face that String do have a character limit.

We just need to convert httpRequest.HttpResponse , which is a stream , because $isobject(response.Data) returns 1; which has a JSON inside it, and we need to convert it to a Ens.Response.

This response is structured as same as the JSON's properties: 

Class Mensajes.Response.Radiologia.CConcertados.BusquedaOrdenesNEGRINResponse Extends Ens.Response
    {

    Property data As list Of EsquemasDatos.CConcertadostoPACS.Radiologia.BusquedaOrdenes;

    ...
3
0 607
Question Yone Moreno · Oct 11, 2023

Hello,

First of all; thanks for your time reading this post, and thanks for your answers and help. I am really grateful.

We have the following need: Send a DICOM Find Document to get the complete list of a patient's studies from an Outbound System, which we simulate with the tool called "dcm4che" specifically with these two commands:

1º.Initialize a DICOM database in simulator. We will use this database to run queries using DICOM C-FIND commands:

./dcmdir -c ./shared/DICOMDIR --fs-id SAMPLEDICOMS --fs-desc ./shared/dicom/descriptor ./shared/dicom

14
0 365
Article Sylvain Guilbaud · Sep 18, 2023 6m read

Hello developers,

In this article, I'll show you how to run code at compile time with ObjectScript macros.

Here's a use case that recently led me to use this feature:

As part of a medical application developed for more than 20 years, we have a large number of parameters. Although we have procedures for documenting these settings, it can be helpful to have a quick view of which settings are actually used by the application code.

0
1 392
Question Yone Moreno · Sep 6, 2023

Good morning,

Thank you for taking the time to read, understand, and answer this question.

If you needed to convert a message where questions are separated by "|", and the question text is the portion before the ":" and the response is the portion after the ":"; Which way would be the most readable and understandable for other developers?

Input example:

NAME OF SQUAD 1?:ALPHA|NAME OF SQUAD 2?:BRAVO|NAME OF SQUAD 2?:ANSWER THREE||NAME OF SQUAD 25?:YANKEE|NAME OF SQUAD 26?:ZULU

Output structure:

2
0 162
Article Ben Spead · Apr 25, 2018 6m read

NOTE:  This content was originally presented at the InterSystems Global Summit in 2014, however related topics often come up on the Developer Community so I have decided to turn this into an article for easier reference and discussion.  However, much of the content was pulled directly from the presentation slides so the article format resembles that of a PPT deck more than paragraphs.

Introduction

Teams that deal with many environments (e.g. for development, testing and production) multiplied by many systems (e.g. billing app, hr app, support app) can face a number of changes:

1
4 1108
Discussion Eduard Lebedyuk · Mar 2, 2023

It's time for a Code Golf round!

Isogram 

A word or phrase that has no repeating letters, consecutive or non-consecutive.


Implement a method that checks if the received string is an isogram or not.
Assume the empty string is an isogram. 
Ignore the letter case.

Allowed inputs: A-Z, a-z.

As usual, the shortest solution wins!

11
0 372
Question Yone Moreno · May 12, 2023

Good morning,

I was wondering:

Given the following scenario where we have a string where each two items are being splitted by "|" as follows: "squadName|initialLetter"

"Alfa|A|Bravo|B|Charlie|C|Delta|D|Echo|E|Foxtrot|F|Golf|G|Hotel|H|India|I|Juliett|J|Kilo|K|Lima|L|Mike|M|November|N|Oscar|O|Papa|P|Quebec|Q|Romeo|R|Sierra|S|Tango|T|Uniform|U|Victor|V|Whiskey|W|X-ray|X|Yankee|Y|Zulu|Z"

And we would need to generate a String structure like:
 

4
0 348
Question Yone Moreno · May 24, 2023

Hello,

We currently have the following scenario: We have a bussiness SOAP Operation, where we get a SAML String and we convert it into a %SAML.Assertion object correctly.

👩‍💻👨‍💻 We would need to send the SAML Assertion inside the SOAP Header to the Target System.

First of all thanks for reading, and thanks for answering.

We currently have opened Log Soap and we do not observe it being added to the SOAP Header, as you would observe in the following Log Soap:

1
0 249
Question Yone Moreno · May 22, 2023

Good afternoon,

first thank you from heart and mind, mind and heart; for reading, thinking, reflecting, responding, and above all explaining a possible solution and/or documentation to address this doubt.

We would need a way to get inside a SOAP Web Service the SAML Assertion, and then, send it directly to the endpoint throught a SOAP Operation.

Currently we have researched and developed how to get the SAML Assertion with the following code:

1
0 371
Question Punit · Apr 24, 2023

I have a %GlobalBinaryStream object that I'm trying to save as a local file after being received through a SOAP Web Service.

To do this, I created a %Stream.FileBinary object and wanted to set where the stream copied to this object would be saved by using either the DefaultStreamDir() ClassMethod or the NewFileName() ClassMethod. However, the documentation isn't very helpful on how to use these ClassMethods.

Right now, I have the below code:

4
0 281