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)?
@Ming Zhou asked a great question in https://community.intersystems.com/post/how-get-all-properties-defined-… and the answer sums up exactly why ObjectScript is my favorite.
When I'm first describing ObjectScript or IRIS to someone I always explain that you can write a class, compile it, get a table, and work with your data from an object or relational perspective - whichever is most natural.
Is there some generic way to output a %SQL.StatementResult to CSV?
I'm in a tricky situation where a new required property is being added to a class, along with an index on it. The existing data has nulls, so the index build fails. I can't run a query to update the rows where there are nulls, because it tries to use the index, which hasn't been built yet.
I realize that a valid workaround would be to remove the index, add the property, run the query to do the update, then re-add the index, but this feels overly messy (and doesn't fit well with my logic for incremental deployment).
If you're building solutions on IRIS and want to use Git, that's great! Just use VSCode with a local git repo and push your changes out to the server - it's that easy.
But what if:
- You're collaborating with other developers on a shared, remote development environment and want to avoid concurrent editing of the same file
- You're using editors based in the management portal for BPL, DTL, pivots, dashboards, etc. and want straightforward source control for your work
- You're still using Studio for some things and/or occasionally jump back there from VSCode - or, your team has not yet fully
I'd like to bring your attention to my two Virtual Summit sessions, even though they're not HALF as cool as Embedded Python.
Git & GitLab for Shared Development Environments details the newly-released git-source-control package (see also on the Open Exchange) which provides a new best-of-breed solution for server-side IRIS/Git integration, especially for shared remote development environments. (I need to write up a post about this package specifically and plan to do so soon.)
InterSystems Package Manager Advanced Topics shows that our package manager (affectionately referred to as "ZPM") is
Hi Developers! As part of an internal company hackathon at InterSystems, I'd love community feedback on a few topics. Feel free to chime on any/all of these via comment or direct message to me.
- If you were to launch a new application/project, what problems would you need to solve right off the bat? What technologies would you use? Why?
- What are the most common and repeated problems that you find yourself solving?
- Where in InterSystems' technologies do you spend most of your time?
- In a solution you have recently implemented, how were your time/efforts allocated?
I'm working in an application that uses %SIMILARITY to find matches among a set of documents that vary greatly in length. It's generally good but I've noticed issues with ranking short partially-matching documents over longer documents that match the search string entirely.
Reading up on the Okapi BM25 ranking function (which is what %SIMILARITY / the %Text package use) at https://en.wikipedia.org/wiki/Okapi_BM25 I see mention of the BM25+ modification, which "was developed to address one deficiency of the standard BM25 in which the component of term frequency normalization by document length
I ran into an interesting ObjectScript use case today with a general solution that I wanted to share.
Use case:
I have a JSON array (specifically, in my case, an array of issues from Jira) that I want to aggregate over a few fields - say, category, priority, and issue type. I then want to flatten the aggregates into a simple list with the total for each of the groups. Of course, for the aggregation, it makes sense to use a local array in the form:
agg(category, priority, type) = total
Such that for each record in the input array I can just:
Do $increment(agg(category, priority, type))But once I've
Introduction
In a previous article, I discussed patterns for running unit tests via the InterSystems Package Manager. This article goes a step further, using GitHub actions to drive test execution and reporting. The motivating use case is running CI for one of my Open Exchange projects, AppS.REST (see the introductory article for it here). You can see the full implementation from which the snippets in this article were taken on GitHub; it could easily serve as a template for running CI for other projects using the ObjectScript package manager.
Features demonstrated implementation include:
- Buil
Introduction
If you're solving complex problems in ObjectScript, you probably have a lot of code that works with %Status values. If you have interacted with persistent classes from an object perspective (%Save, %OpenId, etc.), you have almost certainly seen them. A %Status provides a wrapper around a localizable error message in InterSystems' platforms. An OK status ($$$OK) is just equal to 1, whereas a bad status ($$$ERROR(errorcode,arguments...)) is represented as a 0 followed by a space followed by a $ListBuild list with structured information about the error. $System.Status (see class reference) provides several handy APIs for working with %Status values; the class reference is helpful and I won't bother duplicating it here. There have been a few other useful articles/questions on the topic as well (see links at the end). My focus in this article will be on a few debugging tricks techniques rather than coding best practices (again, if you're looking for those, see links at the end).
Over the past year or so, my team (Application Services at InterSystems - tasked with building and maintaining many of our internal applications, and providing tools and best practices for other departmental applications) has embarked on a journey toward building Angular/REST-based user interfaces to existing applications originally built using CSP and/or Zen. This has presented an interesting challenge that may be familiar to many of you - building out new REST APIs to existing data models and business logic.
As part of this process, we've built a new framework for REST APIs, which has been
This article will describe processes for running unit tests via the InterSystems Package Manager (aka IPM - see https://openexchange.intersystems.com/package/InterSystems-Package-Manager-1), including test coverage measurement (via https://openexchange.intersystems.com/package/Test-Coverage-Tool).
Unit testing in ObjectScript
There's already great documentation about writing unit tests in ObjectScript, so I won't repeat any of that. You can find the Unit Test tutorial here: https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=TUNT_preface
It's best practice to include your unit
Introduction and Motivation
A unit of ObjectScript code (a ClassMethod, say) may produce a variety of unexpected side effects by interacting with parts of the system outside of its own scope and not properly cleaning up. As a non-exhaustive list, these include:
- Transactions
- Locks
- I/O devices
- SQL cursors
- System flags and settings
- $Namespace
- Temporary files
Use of these important language features without proper cleanup and defensive coding can lead to an application that normally works correctly, but that may fail in unexpected and difficult-to-debug ways.
I've been having a blast with the Advent of Code puzzles this year - though I'll be heading into a busy span of time with family soon and will probably drop off toward the end. (At least, that's what always seems to happen - it's a good thing, though!)
I had a whole plane ride to play around with Day 13 and wanted to share some fun terminal tricks. I'm not planning to post my solutions on GitHub until the end of the year, but this is just visualization fun - not relevant to solving your own puzzle input (although visualization definitely helps for debugging) ![]()
In my initial visualization, I was
Is there a quick way to see if an SSL/TLS configuration name is valid, short of switching over to %SYS and checking Security.SSLConfigs:Exists?
Is there a datatype class with validation for global references? I can't find one in a brief scan of the documentation / class reference.
Problem:
I want to be able to import XML (say, using %XML.Reader) to Caché objects permissively (ignoring invalid/unexpected tags/attributes), but also to validate the same XML and list any/all invalid tags/attributes that it contains.
Does anyone know of a utility to compare two databases (i.e., CACHE.DAT files) and find globals/subscripts that are different between them?
If not, I'll write one and share it. ![]()
Is there an equivalent to $System.OBJ.MakeClassDeployed (see documentation) that has the same effect for routines, deleting the .mac/.int but not the .obj?
Suppose I have a web application named "/my/api", with a dispatch class configured (a subclass of %CSP.REST), and I want to be able to respond to:
GET /my/api/something/:id
by loading an object with the specified ID and returning it as JSON
GET /my/api/another-thing/data.js
by returning the contents of a file (data.js) in a configured location in the filesystem, ideally based on the "CSP files phsyical path" for /my/api.
On my "Posts" page (https://community.intersystems.com/user/10056/posts), the title is "Posts (#)".
On my "Comments" page (https://community.intersystems.com/user/10056/comments), the title is "Comments (#)".
On my "Answers" page (https://community.intersystems.com/user/10056/answers), the title is "Evgeny Shvarov":

I think this is a bug. ![]()
Given a complex method flagged with [ SqlProc ] so it is available as an SQL stored procedure, what's the best way to report a non-system error detected in that method - say, for example, an error %Status - so that the SQL query calling it fails descriptively? Is it best to create and throw an exception, or are there special % variables involved (like in a trigger)? I haven't been able to find an answer in the documentation.
Thanks in advance!
I've been trying to write a method to compare two local variables, which may be arrays, for "equality" - that is, to see if they have all the same subscripts (if they're arrays) and values. This is the best I've come up with so far - are there any better/simpler approaches out there?
/// the same values at those subscripts.The topic of for/while loop performance in Caché ObjectScript came up in discussion recently, and I'd like to share some thoughts/best practices with the rest of the community. While this is a basic topic in itself, it's easy to overlook the performance implications of otherwise-reasonable approaches. In short, loops iterating over $ListBuild lists with $ListNext or over a local array with $Order are the fastest options.
As a motivating example, we will consider looping over the pieces of a comma-delimited string.
A natural way to write such a loop, in minimal code, is:
ForIn the subscriptions e-mails I get (digested), the URLs are typically wrapped across lines, like:
| Post link: | |http://community.intersystems.com/post/explanation-defaultdb-database-2 |01610 Direct unsubscribe link (content type):
My mail client can't handle this, of course; the link doesn't work. (The actual link in this case is: https://community.intersystems.com/post/explanation-defaultdb-database-… )
There have been a few use cases recently within InterSystems where we've needed to connect to Caché-based web services from PHP. The first of these was actually the Developer Community itself, which uses web services as part of Single Sign-On with other InterSystems sites/applications. The following example demonstrates how to connect to a Caché-based web service (particularly, the web service in the SAMPLES namespace) from PHP, using password authentication.
Is the default language (i.e., $$$DefaultLanguage, which is used as the basis for localization with $$$Text/etc. at compile time) always "en" for new Caché installations, or could it be different? How is this determined? I don't see an option to select a language during Caché installation.
Also, is there a supported/preferred API for setting the default language? Looking at %occMessages.inc, one option would be:
Set $$$DefaultLanguageNode = "en"
But I'd expect there to be a classmethod for this somewhere (and haven't managed to find it yet).
Background: My team is concerned about what might
I'm revisiting some older projects that can benefit from the new JSON support and dynamic object capabilities in 2016.1 FT / 2016.2 FT. (Particularly, some of the really new features in the latest 2016.2 FT.)
For the particular thing I'm working on, it would be very handy to be able to merge objects, similarly to https://api.jquery.com/jquery.extend/. The closest thing I've found so far (in 2016.2 only) is:
Write "o1: ",o1.$toJSON(),! Write "o2: ",o2.$toJSON(),! Write !
Looking at a property defined as follows:
Property SystemTime As %Library.TimeStamp [ SqlComputeCode = {Set {*}=$ZDATETIME($NOW(),3,1,0)}, SqlComputed ];
The documentation talks about using SqlComputed and SqlComputeCode with SqlComputeOnChange (specifying which events will trigger computation), and about using them with the Calculated keyword (so it's always computed). I don't see any specific explanation of the case above, though, when neither SqlComputeOnChange nor Calculated is specified.
From a bit of testing, it seems that the behavior is:
- Upon SQL insert or first %Save, if no value has