1. set tSC=...
do $SYSTEM.Status.DisplayError(tSC)
2. set tSC=...
zwrite tSC
3. An alternative?
Is there a meaningful difference between the two? Should one be used over the other for any reason? Should something else be used?
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.
1. set tSC=...
do $SYSTEM.Status.DisplayError(tSC)
2. set tSC=...
zwrite tSC
3. An alternative?
Is there a meaningful difference between the two? Should one be used over the other for any reason? Should something else be used?
We are running Batch job in scheduled task and the messages are picking in single session and it is not easy to trace the record.
I used the Set ..%SessionId= "" at before sending the message to BP but I see the session Id is '1' created for each message.
Is there anyother way to create new session for each message sending to BP?
Thanks,
I am trying to work on a ZMIRROR that will execute a shell script to failover our VIP at the hardware level when NotifyBecomePrimary occurs.
ZMIRROR ; Custom logic for specific mirroring events
q
;
NotifyBecomePrimary() PUBLIC {
#;This procedure is called as a notification when this system becomes Primary.
#;It does not return any value.
#; invoke the command to select this host for running the crontab
try {
Set cmd = "/usr/local/sbin/failover-intengtest-vip_SR"
d $ZF(-100,"/SHELL /LOGCMD /STDOUT=/archive/logs/failover-intengtest-vip.ZPM is a package manager designed for convenient deployment of applications and modules on the IRIS platform.
Module developers, in order for their module to be installed using ZPM, need to follow a series of simple steps.
I am trying to write a ZMIRROR routine that makes a shell script call using $ZF
Set cmd = "/usr/local/sbin/failover-intengtest-vip"
Do $ZF(-100,"/ASYNC /SHELL",cmd)The script I am calling is returning an output to the screen, how do I get around this using $ZF without having to rewrite the scripts?
Thanks
Scott
Hi all,
The last time I used CSP was back in 2008, so I am very rusty on it.
This question might have been asked many times, and the answer probably is that it is a matter of preference.
Are there scenarios to which CSP pages is easier/better to use than classes extending from %CSP.Page?
I want to build a little thing and don't want to start at the wrong end.
Doing an API-based, heavy client-side framework is not a requirement, and I would prefer not to do it that way.
Some of the criteria
HI *,
So last night I was doing a deployment which had a query to select from a large dataset of joined tables, to iterate through and populate data in a new table.
This was done in a classmethod using embedded SQL and the %PARALLEL keyword.
On a testing environment with the same dataset, this worked perfectly a few days earlier.
It was going to be a long-running process, so we started it from a csession using the JOB command.
Then get the PID with $zchild, go to Processes and monitor it there.
It would terminate after a minute or so with a <STORE> error.
The per process memory is set at 1GB.
Hello Guys,
Our cache application uses REST web services and handles single API request perfectly with response (response status and related data). But sometimes user sends multiple requests to the same API simultaneously ( ie, without waiting for the first to respond ), where one request will succeed (not necessarily the first) and the others will fail.
So, I need to handle the requests one by one after completing and sending the response for first request in the queue then process the next request and so on.
Is there any appropriate way of handling this problem?
Hey Community,
Our huge thanks to everyone who participated in the Advent of Code 2023! We're pleased to present the winners and distribute all the prizes.
Our congratulations to these developers:
🥈 @Maksym Shcherban (w/ repo)
🥉 @Yuval Golan (w/ repo)
Here's the final InterSystems leaderboard:
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.
This article contains three snippets of code.
I got a problem to resolve, to sum it up I need to extract a function body from a JS file with cos.
I already got the JS code in a string and the function name but I'm kinda stuck as to how to get my function body, I already tried a few things (regEx, counter bracket) but there are comment and strings that block them from functioning. Is there a javascript parser or a good way to do it except by creating a javascript parser?
Hi Community,
We know you're eagerly anticipating this moment for an entire year (and we've even got messages asking if it is happening 😉)... Well, the moment is now here!
Join the Advent of Code 2023 with InterSystems and engage in our ObjectScript contest for a chance to win fabulous prizes!
.jpg)
Hi,
The system I am working on processes large numbers of records. Inserts, updates and so forth. There are multiple processes that can potentially work on the same table at the same time.
It is an almost impossible task to try and time these processes to not run at the same time, due to volumes, SLAs, etc.
Every now and then there are a few locking issues, Not many considering the volumes. It is just a bit of a nuisance as we need to reprocess these records later.
All the selects on the processes run at IsolationMode 0 and the transactions are kept as short as possible.
How to clone dynamic objects more efficiently than using a serialization/desserialization approach (eg. Set objectB = {}.%FromJSON(objectA.%ToJSON()) ) ?
Why %DynamicObject could not extend %RegisteredObject and its %ConstructClone method (if not inherit it)?
Hello everyone!
Sorry for the vague title! But I wonder what would be the best way to easily import a large XML-file into a production, modifying it by deleting elements and nodes depending on what values are in those nodes/elements and later creating whole new XML-file from that?
I have gone through this: Using Caché XML Tools | Caché & Ensemble 2018.1.4 – 2018.1.8 (intersystems.com)
But I get the sense that there are a lot of ways of approaching this, but I do not know what is the most effective for my certain needs.
I appreciate the help! Thanks beforehand! :)
Hello everyone!
I have to build a REST service that receives a POST HTTP-request, collect a file from that request in the Form data and then send it in another HTTP Post request through Form Data. However I can't really seem to send the file, and I do not know where it has gone wrong. All I am getting told is that no file is being received from my HTTP Post request. I am reaching the REST Service I am supposed to send the request to, but nothing is being sent.
I would be really thankful if someone could give some insight why nothing is being sent in my request. Thanks beforehand!
I'm receiving a JSON payload via a REST API, I'd like to %JSONImport this stream into a class which extends %JSON.Adaptor. The problem is that the JSON is an array whose elements have no key (as you can see in the example JSON below). Right now I'm having to do some manipulations to convert the stream into a dynamic object and do a %Set which inserts a made up key "record" so "thingone" and "thingtwo" have an associated key that I can use when referencing "thingone" and "thingtwo".such as record.
How do we trigger a BPL Business Process on a time schedule?
We are building a production that takes a steady stream of (HL7) lab results messages, processes them and stores them in a temporary database table. At scheduled points during the day (eg 0800, 1300, 1600) the database is queried and messages sent on to the downstream system. Aiming that the Processes to be implemented in BPL if possible - but we are having trouble triggering code in a BPL as a scheduled job.
I want to call the REST endpoint and return the list of objects. I`ve created the method but it displays an error:
<METHOD DOES NOT EXIST>GetAllPersons+10^Lab3.RestClient.1 *Count,%ZEN.proxyObject
ClassMethod GetAllPersons() As %Status
{
Set request = ##class(%Net.HttpRequest).%New()
Set sc = request.Get("http://localhost:52773/csp/crud/persons")
Quit:$System.Status.IsError(sc) sc
Set responseStream = ##class(%Stream.GlobalBinary).%New()
Set response = request.HttpResponse.Data.Read()
Write "Response from Server:", !, response, !I am trying to run the CSP server. But I get the error:.png)
It worked once, but when I made some changes is displayed an error.
Also, a WEB page looks like this:.png)
Did you face this issue? What is the reason for it?
I need to create a simple REST application.
I`ve created an app:.png)
Also here is a dispatcher class:
Class Lab3.helloWorld Extends %CSP.REST
{
Parameter Authentication = 0;
Parameter HandleCorsRequest = 0;
XData UrlMap [ XMLNamespace = "https://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/hello" Method="GET" Call="Hello" />
</Routes>
}
ClassMethod Hello() As %Status
{
Do ##class(%REST.Impl).%SetContentType("application/json")
If '##class(%REST.Impl).%CheckAccepts("application/json") Do ##class(%REST.Impl).%ReportRESTError(.Welcome everybody!
In this short article I would like to present an example of use that surely many of you who work with IRIS as the backend for your web applications have faced on more than one occasion and it is how to send a file to your server from the frontend.
Generally the simplest way I have found to perform this task is to transform the file from the frontend to the Base64 format and make a POST call to our server attaching the Base64 obtained to a JSON message in which I indicate in a parameter the name of the file and in another the encoded data.
I am attempting to setup my first OAuth2 client, as we are adventuring into the realm of making FHIR API calls to our EMR from HealthShare Health Connect.
I have gone through and set up the Issuer Endpoint, and Client Configuration but now I want to test it and verify that the setup is correct. When I setup the Client Configuration, it would not allow me to use Discovery as it was saying I needed a "Client secret" but was not given one. So I set it up manually, thinking I hit all the information correctly.
Hi Community,
Can I please check if any one is aware of any functionality in HealthShare to verify NHS Number check digit.
We are trying to implement the NHS Number check digit validation using Modulus 11 Algorithm ( described here : NHS NUMBER (datadictionary.nhs.uk) )
I wanted to check if there is any built in option available or if anyone has implemented something similar using Object Script.
Thank you for your help.
Mary
Anybody know if there is a ObjectScript kernel for Jupyter? Would be kinda interesting to testing scripts, etc. And since we kinda have the language runtime in the VSCode ObjectScript extension I wonder if that could be utilized fora jupyter kernel?
When executing OS commands, use $ZF(-100).
do $ZF(-100,"",program,args) // Execute the Windows command [synchronously].do $ZF(-100,"/ASYNC",program,args) // Executes a Windows command [asynchronously].When executing OS shell commands such as mkdir and copy, also specify /SHELL.
do $zf(-100,"/shell /async","mkdir","c:\temp\x")Please refer to the following documents for details:
I have a API that is returning on objext with four fields. Two are arrays that are empty. How can I define the message class property to ignore/handle "Messages" and "SharedRelations"?
.png)
I getting the response back to my method fine,
.png)
but it is not returning to my BPL.
.png)
What am I missing to get the response back to the BPL?
set tHttpResponse=##class(%Net.HttpResponse).%New()
set tSC = ..Adapter.SendFormDataArray(.tHttpResponse,"POST",tHttpRequest,"","",tURL)
set tStatusCode = tHttpResponse.StatusCode
$$$TRACE("Status Code: ["_tStatusCode_"]")
do ..logJSON(tHttpResponse.Data.Read(),"Post Relation Response")
// On HTTP 200 - OK
if tStatusCode = 200 {
do tHttpResponse.Data.Rewind()
do pResponse.%JSONImport(tHttpResponse.
I am creating a custom message class. How do I define @name and #text fields?
this?
Maven is a tool, hosted by the Apache Software Foundation, for building and managing any Java-based project. Apache Maven is the best source of information.
Managing a project, its dependencies, and life cycle can be a tedious task. Maven automates these tasks, making project management much simpler. Maven also defines a standard directory layout and provides tools for initializing projects. These tools employ project templates called maven archetypes There is a rich library of archetypes available.