InterSystems FAQ rubric

Using the Config.Configuration class and SYS.Database class methods, you can create and register a namespace database from the terminal.

Below is a series of execution examples that create database file /CacheDB/AAA/cache.dat and register database AAA and namespace AAA in the configuration file (cache.cpf).
* Execute in the %SYS namespace. *

* Make sure that this script runs as the user that is used for all IRIS processes to ensure that the directory has appropriate ownership and permissions *

4 3
0 269

I have the following method call (have included html and css as well). when I debug the code in a browser, JavaScript seems to work fine. Loading image is coming up, table is getting hidden. But when I close the debug and just load the page and run it, loading image is not coming up, neither the table is hidden. Not sure what is going on? I need help to understand what I am doing wrong?

XData Style

{

<style type="text/css">

#loading {width: 100%;height: 100%;top: 0px;left: 0px;position: fixed;display: block; z-index: 99}

0 3
0 107

We are looking at what we need to do to migrate from our current usage of Zen reports to InterSystems Reports. One of the hurdles for us is figuring out ways to interact with InterSystems reports programmatically from ObjectScript routines. There is a Java API for it, but it is possible to generate a report from InterSystems reports to a stream object in ObjectScript without diving into Java by using a %Net.HttpRequest. Here is a code example, followed by an explanation:

1 0
0 125

I am trying to call to a website that renders a xml structure as a response.if I put the url on the browser an xml rendered page is returned but if i call to this using the below code I get an object reference error which I am finding had to understand is there anyone who could help understand this error or point me in the right direction thanks.

Set tSC=$$$OK

0 2
0 162

Hi,

I'm trying out VS Code with IRIS for Health 2023.2 (not available in above dropdown) in a local container. I can open read-only files in the Objectscript viewer and have a local folder connected to the correct namespace. However, when I make changes and try the "import and compile" option, I get:

ERROR #16006: Document <filepath> name is invalid

The first four chars of <filepath> appear to have been truncated

Here is my settings.json

{

"security.workspace.trust.untrustedFiles": "open",

0 4
0 249

Methods written in ObjectScript can use pass-by-reference arguments to return information to the caller. Python doesn’t support pass-by-reference arguments, so Embedded Python in IRIS doesn’t support them either. That's it, that's the end of the post, hope you liked it. 😉 But wait, what about the Classic Rock & Roll?

7 1
1 250
InterSystems Official
· Feb 27, 2023
VS Code ObjectScript releases v2.6.0

I'm pleased to announce version 2.6.0 of the VS Code ObjectScript extension, containing a number of enhancements that make a developer's life easier. Some highlights are described below. As always, find the full list of modifications in the CHANGELOG, including many bug and vulnerability fixes.

16 15
1 600

Example:

Method Execute (args...) As %Status {
...
 #dim statement as %SQL.Statement
 set statement = ##class(%SQL.Statement).%New(2)
 set statement.%Dialect = "CACHE"
 do statement.prepare(query)

 #dim rs as %SQL.StatementResult
 set rs = statement.execute(args...)

My questions are: 1) how do I get the size of args **2) how to get all values of **args **3) is it possible to modify the **args?

0 6
0 237

Trying to gather basic code examples written in ObjectScript and realized it's probably easiest to ask the people who know what they're doing!

I'm looking for examples of the following five prompts all in ObjectScript:

Prompt 1. Write a function that partitions the array into two subarrays: one with all even integers, and the other with all odd integers. Return your result in the following format:

[[evens], [odds]]

Prompt 2. Create a function that computes the hamming distance between two strings

0 3
0 172

I have a situation where I have a handful of classes which I need to copy to another Namespace (which uses a different RoutineDB) on the same instance, load it and compile it.

Can anyone help me come up with a command that will do this quickly and easily? Perhaps something with extended reference?

This is somewhat time sensitive so thank you in advance for your ideas!

0 23
0 601

Has anyone had success with passing in a collections property within a SOAP request to a Soap Service in Ensemble? Please reply with how you set up that collections property. I am able to successfully send a SOAP request correctly containing the elements of the collection property to Cache, as seen in a custom soap log file which I am using to troubleshoot. But the collection property in the Ensemble request is not getting serialized, meaning MyContainers has nothing.

My.Request consists of a property, MyContainers, which can have 0 or more Containers (My.Container)

0 1
0 107

I'm trying to write an ObjectScript function that sorts version numbers to help learn ObjectScript. This is all I can think of after staring at VS Code for a while, but I don't know where to go with it. Can someone please help out with a tip? The goal is to take something like ["1.4.5", "0.5.3", "6.3.2", "1.2.4"] and turn it into ["0.5.3", "1.2.4", "1.4.5", "6.3.2"]

0 4
0 214
Question
· Apr 13, 2023
Breaking a string into words

Is there any ObjectScript or a basic function that takes a string and separates it into words + punctuation/spaces array/list? Just not to reinvent the wheel. Say, process "It is a test, after all" into "It", space, "is", space, "a", space, "test", ", ", "after", space, "all". Or something to that effect.

2 9
0 319

Hi Devs!

For me, one of the most painful things about ObjectScript is ##class(Class).Method() typing to call a class method in code or in a terminal. I even submitted an idea to simplify it in ObjectScript.

But! There is a new feature in VSCode ObjectScript that was just introduced to the plugin - Copy Invocation!

10 7
2 555

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:

1 4
0 197

I wrote a function awhile back to take Encoded Base 64 and write the PDF out to a file that could be sent to a faxing system to fax out. We are trying to test this code out in IRIS and I am seeing an error that I have not seen before... ERROR #5034: Invalid status code structure

Here is the code...

ClassMethod DecodeBase64HL7ToFile(base64 As %Stream.GlobalBinary, Ancillary As %String, FileName As %String) As %String

{

set ArchDir = "/ensemble/data/transfer/AncillaryPDF/"

0 7
0 271
Article
· Apr 16, 2023 4m read
Tuples ahead

Overview

Cross-Skilling from IRIS objectScript to Python it becomes clear there are some fascinating differences in syntax.

One of these areas was how Python returns Tuples from a method with automatic unpacking.

Effectively this presents as a method that returns multiple values. What an awesome invention :)

out1, out2 = some_function(in1, in2)

ObjectScript has an alternative approach with ByRef and Output parameters.

Do ##class(some_class).SomeMethod(.inAndOut1, in2, .out2)

Where:

3 0
0 250

We have a function that was written for us that allows us to create text files for logging certain aspects to the OS using %Stream.FileCharacter. We had no issues with this until we moved from AIX to Red Hat.

Now it seems the 1st time the function is called, and the file is created the permissions seem to be correct on the file. But as soon as we attempt to write another line to the file using MoveToEnd() it seems the permissions are changed on the file. I have been able to narrow the issue down to the MoveToEnd() by calling the function from different users.

0 9
0 396
Question
· Feb 18, 2019
%String to XML

Hi

I've got a string variable which I need to convert into a XML one.

My main goal here is to use the XML bit I've extracted from a HTML file in a message I need to pass over to an operation.

I'm doing the following which always errors

classMethod WriteNodes(myfile As %String)
{
Set status=##class(%XML.TextReader).ParseString(myfile,.reader)

....

Any easy way of making this happen?

Kind regards

0 18
1 1.6K