My segment is not getting set with the new value though It goes into the if statement. Am I doing something wrong?
s cREQ = pRequest.%ConstructClone()
s diag = DG1.GetValueAt(4.1)
{
s tmp = "No code"
s rc=DG1.SetValueAt(tmp,4.1)
}
}
Quit request
}
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.
My segment is not getting set with the new value though It goes into the if statement. Am I doing something wrong?
s cREQ = pRequest.%ConstructClone()
s diag = DG1.GetValueAt(4.1)
{
s tmp = "No code"
s rc=DG1.SetValueAt(tmp,4.1)
}
}
Quit request
}
Forgive my lack of understanding, but I am working on a vendor created Cache database and the indexes specified in the classes for ODBC connections are not working. A few of them are created, but of the 50+ classes we have, only a handful of them are created when the class is compiled, yet no errors occur.
Example 1:
.png)
.png)
Example 2:
.png)
.png)
The code is creating the Index, and again, not compile errors, but most of the indices are not built.
Hi guys!!
In the system that I work, I came across an iterator pattern that uses the %Resultset library without performing the close after executing the query. Does anyone know how to say what are the impacts of not performing such a procedure?
If you have any model of iterator pattern made in caché to recommend as a good example, I will be grateful hehe :D
Hello Developer Community!
I’m pleased to announce the 0.9 release of the ObjectScript extension for Visual Studio Code. Earlier this year I announced that InterSystems would be joining the community in evolving this already popular tool. Since then, we have been hard at work solidifying the code base and building a slew of new features.
Before I get into the details, I’d like to take a moment to thank @Dmitry Maslennikov, @John.
Common macro def as following
#def AnyNumber(%args) for i=1:1:$listlength(%args) { Write $listget(%args, i)}
Using this marcro in objectscript code:
ClassMethod Test() as %Status {
$$$AnyNumber($lb(1,2,3))
}
if ths args is literal value , Iit worked great. But When I want pass Objects, It's not working
$$$AnyNumber($lb(##class(someClass).%New()))
I know I can pass a %ListObjects , If I want more shorter Line. How can I do this.
Tks
I have come across several cases where I need to set a Date filter to send only send any admit/scheduled date past a certain point. We have a couple different date comparison functions but none looking at the true date. Most of them are date + 15 or etc. Does anyone have a good date function they have written to say if x > 20170102 ?
Thanks
Scott
I have java language experence. If I need parse a binary tcp packet . like following format
encoded string and send it to peer by tcp
1byte msg type + 4 byte(unsigned int) + raw byte(body)
To parse this package , Some Java code like this:
byte[] data = new byte[1024];
Bytebuf buf = new ByteBuf(data)
byte type = buf.read()
int len = buf.ReadInt()
byte[] bodyBuff = new byte[len]
buf.Read(bodyBuff)
String str = new String(strBody)
So, does Objectscript have similar functionality to achieve similar results?
Tks.
Error management on InterSystems languages has been evolving along time. Next, we will show the different implementations and why you should use the TRY/THROW/CATCH mechanism.
You can read official error recommendations here.
InterSystems will not mark as obsoletes the non-recommended error management methods to allow giving support to legacy applications. We recommend using tools like objectscriptQuality to detect that legacy unrecommended usage along with many other possible issues and bugs.
I was able to define ECP connection in Installer class that I run when I build docker image for my Docker IRIS application. Now I start to use Amazon ECS and Autoscaling. When a new instance is created and it runs the IRIS container, I want it to "register" as an Application server on the remote database server. What code can I execute to add an ip address as an Application Server?
Just like the title, I want to do code version control. I don't want to change CLS at will, but I don't want to use MakeClassDeployed, I just want to set the cls or mac to read-only and uneditable state。Does CLASS have such property?
I have a list of 300 code combinations in the following format, which I plan to load into a global
X123, Internal health
X234, external health
X345, Peripheral health etc..
I want to get the code from the DG1 segment, compare to the global, and add a description. Is there an easy way to do it?
So in my DG1 segment If I get the code X123, what I want to do is check if the code is in the global and if it does add the description in the field.
So DG1 will look like this:
I use these example classes:
{Property Street As %String;
Property City As %String;
Property State As %String(POPSPEC = "USState()");
Property Zip As %String;}
Class Sample.Person1 Extends (%Persistent, %Populate)
{ Property Name As %String;
Property Home As Sample.Address;
Property AR As array Of Sample.Address; }
In SQL it is Table Sample.Person1.png)
No problem to define INDEX on Home_State
But Table Sample.Person1_AR.png)
HowTo define an INDEX on AR_State ?
Does not compile!
Hi all.
I have a reponse message that has a property of the type %Collection.ListOfObj and I need to search for an item in this list. Let me show you.
We are using Ensemble and I added some debug logging that writes to a global and recompiled the class in Studio. However, when we send messages, the global is not populated. I have recompiled, removing the checkmark to keep the generated code so that there is only one .INT file and I verified that the code is present in the .INT file.
My question is, do we need to stop and restart the Ensemble production in order for these changes to take effect? Do I need to stop and restart the business operation that calls this piece of code? Is there something else I may have missed?
Greetings,
Since cache is an OOP language, how can I create 2 methods with the same name but different parameters? Right now when I try that I get a compile time error!
Thank you,
Everardo
Hi,
Can anyone please explain me how to remove trailing squares from the text field (String). Trailing squares is a white space ?
I tried different things like Ltrim, Trim from sql query side and also from object scripting side something below.
If Address1 set Address1 = $ZSTRIP(Address1,"<>P,<>C,<>W")
If Address1 set Address1 = $ZSTRIP(Address1,"$C(9), $C(32), $C(160)")
If Address1 set Address1 = $ZSTRIP(Address1,"*W,*C")
Nothing works for me
Can anyone please help me to solve this
Thanks
We have a vendor that every couple of days will just stop transmitting messages, but still hold the TCP/IP connection open. No matter how many times we troubleshoot and talk with them, they don't seem to think its an issue with system. Normally if I just restart the service it will get the data flowing again.
I know ideal is for them to fix the issue, but in the meantime I have setup an Inactivity time out alert. I was wondering with the correct filtering if there was a way to say if the Inactivity Alert is triggered during the business day, to have the Alert trigger a restart of the service?
Hi Developers!
As you know the application errors live in ^ERRORS global. They appear there if you call:
d e.Log() in a Catch section of Try-Catch.
With @Robert Cemper's approach, you can now use SQL to examine it.
Inspired by Robert's module I introduced a simple IRIS Analytics module which shows these errors in a dashboard:

During my search for a snapshot of a persistent object,
I met a feature that I would like to share as it could be useful in some special situations.
My trigger was to have a before- and an after-image during unit testing.
Now I want to return a large amount of data to the front end. The string length has reached 40000 +, and the returned data needs to be encrypted by AES + Base64. I can convert the string into a stream. AES can use the AESCBCEncryptStream method to encrypt, but Base64 has no stream method。Anyone who get the solution would you kindly share the solution please。
Any help would be appreciated. Thanks!
Hi Devs!
A few months ago I raised a discussion on the naming convention for ZPM modules.
And you free to put your name or your organization name for the packages you want to have your personal or company's brand.
But if you contribute to community, we suggested to have "community." package for all such libraries.
But the name is too long.
What if we use "isc." instead? Which can be read as "isc ->InterSystemsCommunity". Short and unique.
What do you think?
Hello for everyone.
We recently started our migration to the cloud. We left a unix environment for a Windows 2016 environment and everything seems normal except for the error ( <ZSOAP> zInvokeClient + 208 ^% SOAP.WebClient.1 ) when we try to consume a web service. In fact, any webservice. The classes have been exported and recompiled but do not work. Apparently by the complements of the error DO $ System.OBJ.DisplayError () (ERROR # 6246: There was no response to the SOAP request) or the $ system.Status.DecomposeStatus (% objlasterror, .
The offer of ZPM is growing daily and the short names and
acronyms of the offer are sometimes hard to understand and
also hard to type with my lazy fingers.
So I decided to have
It runs with do ^zpmshow
A snapshot from the screen:
USER>d ^zpmshow
1 analyzethis 1.1.4 -- not github --
2 apps.rest 1.0.0 -- no descripition --
3 bitmap-adoption 1.0.
Hi Developers!
I'm pleased to present to you a new feature of Open Exchange - ZPM Package Manager support!
What's about it?
It would be interesting if there is some recommended documentation about best practices using Healthshare for interoperability.
Also, some how-tos or frequently asked questions about ObjectScript.
Or event better, if there are experienced developers who would like to share some common habits on their work with Studio / ObjectScript, which are valuable to do the developing work better.
For example, How to get the XML of a class and write it into a REST operation:
...
set status=
This is a sample to use %JSON.Adaptor class available in IRIS to produce a snapshot of your object.
The sample consists of 2 classes that are variations of what was known in Caché/SAMPLES as Sample.Person.
Be aware that the possibilities are limited by %JSON.Adapter and how you make use of it.
Once in place, you create some test data by Populate().
You select an object and take a snapshot.
You apply changes to your object and take another snapshot.
And see the difference.
BINGO!
It's also an example of a customized SystemFunction extension (ZZISJSON) in Caché & IRIS
This time it is to be included in %ZLANGF00.mac
A JSON string is mostly imported from a file or over REST
You rely on a clean and compatible structure. This is the check.
required: ZPretty.mac
demo
USER>ZWRITE jsn
jsn="{"Name":"Li,Robert K.","SSN":"672-92-9664","DOB":"1975-01-12","Home":{"Street":"986 Washington Blvd","City":"Boston","State":"PA","Zip":"95802"},"Office":{"Street":"6012 First Place","City":"Reston","State":"MT","Zip":"77739"},"Spouse":{"Name":"Avery,Zelda H.t's also an example for a customized command extension (ZZJSN) in Caché & IRIS
This is the Caché version for fast JSON formatting but it also works in IRIS.
Requires package ZPretty
To allow parallel existence in IRIS this is named ZZJSN
see:
USER>ZWRITE jsn
jsn="{"Name":"Li,Robert K.","SSN":"672-92-9664","DOB":"1975-01-12","Home":{"Street":"986 Washington Blvd","City":"Boston","State":"PA","Zip":"95802"},"Office":{"Street":"6012 First Place","City":"Reston","State":"MT","Zip":"77739"},"Spouse":{"Name":"Avery,Zelda H.t's also an example for a customized command extension (ZZJSON) in IRIS
IRIS has a nice %JSON.Formatter class.
But for debugging it is not really handy.
see:
ZWRITE js1
js1="{""Name"":""Cunningham,John C."",""SSN"":""294-11-9150"",""DOB"":""1933-01-08"",""Home"":{""Street"":""4249 Ash Street"",""City"":""Tampa"",""State"":""MD"",""Zip"":""30176""},""FavoriteColors"":\[""White"",""Red"",""Green""]}"
so you proceed for the most simple case
set formatter=##class(%JSON.Formatter).%New()
do formatter.Format(js1)
{
"Name":"Cunningham,John C.IRIS and Caché / Ensemble offer the possibility to add Languages Extension as SystemFunctions, SystemVariables, SystemCommands
The related documentation tells you where to add the system-wide extension. Parameter passing is not covered explicitly.