I have a registered object class that extends %XML.Adaptor and I want to convert an object of it into canonical XML.

From reading the documentation and some trial and error, it seems like I would need to use %XML.Writer to write the object to XML first using the RootObject() method, then read it with %XML.Reader, and then use the Canonicalize() method of %XML.Writer to write it out again.

Is there a better approach?

1 2
0 353

When using VS Code for Objectscript, is there a way to directly open % classes, like %Library.String, without needing to search for a property of that type and right clicking->"Go to Definition"?

I know it is possible to use "system=1" in the workspace uri definition to see all the % classes, but that tends to clog up the left side viewer with many extra directories. There is also the option in the settings to selectively hide some by defining files.exclude, but it seems fairly complicated to set up a filter for exactly the relevant directories.

1 4
1 308

Let's say I have two lists of connected data where elements of listTwo only make sense if given an item of listOne as context:

listOne = ["A", "B", "C"]

listTwo = ["x", "y", "z"]

Tuples like ("A", "y") and ("C, "x") make sense, but "A" or "x" by themselves don't. I would like to pass in a list of such tuples into a method and have it handle each tuple in the list. So what would be the best way to format them given that ObjectScript does not have specialized tuples? Would it be nested $LISTBUILD lists or something else?

0 1
0 253

Is there a reason why calling %ExecDirect() (or %Execute) won't set the %SQLCODE of the result set to 100 even when the query returns no data?

Here is the code in question with a bit of contrivance to force the issue:

set statement = ##class(%SQL.Statement).%New()
set result = ##class(%SQL.Statement).%ExecDirect(statement,"select top 0 0 from Example.Testing")
w result.%SQLCODE

The %SQLCODE is set to 0 in this case. The same happens if I use %Prepare and %Execute, e.g.

1 8
0 482

Does anyone know of a relatively quick and straightforward way of converting code written in the old dot scoping syntax with argumentless do (see here for reference: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_cdo_legacy) to the modern parentheses scoping syntax? It's not too bad to do it by hand, but it's also easy to make a mistake and leave a "quit" in an if statement by accident for example.

E.g.

1 10
1 550

I have run into two annoyances when using VS Code for server-side editing of Objectscript and was wondering if anyone knows of any solutions or workarounds.

1. In .mac routine files, class names that aren't fully qualified (e.g. ##class(example) instead of ##class(Package.example)) fail to be understood, so the class will have a red squiggly underneath it and a problem that reads

"Class 'example' does not exist. InterSystems Language Server".

0 2
0 206