User Answers

If you've specified the language as "basic", then I would expect the Right() function to be available. Otherwise, for "objectscript", you'll want to use something like $extract(string,*-10,*).

Edit: if there's some reason to prefer using the methods supplied by the wizard, you could also do something like this: ..SubString(string,..Length(string)-10)

When you're using subscript indirection with a recursive $order traversal, you may find the $name function useful; e.g.,

    do ..RecursiveGlobalCount($na(@pGlobalName@(tKey)),"",.tCount)

As the other answers suggest, you probably want $query instead of $order, but $order can be useful for summarizing on multiple subscript levels (e.g., count, min, and max per country, state, and city).

The %SYSTEM.SQL::Execute() method returns an %SQL.StatementResult object. I'm not that familiar with the iris.node module, but it appears that invoke_classmethod() does not return an object that you can pass to invoke_method() or get_property(). However, it seems that you can fake it by copying the "result" field into a new object as "oref":

The main thing I can suggest is to verify that the client and server agree on the encoding. It's been years since I've used Reflection; hopefully it supports UTF-8. Check your settings and/or documentation.

When you're in a Caché session, look at the value of the $zmode special variable:

USER>w $zm
RY\Latin1\K\UTF8\

I'm not sure offhand what determines the default I/O translation table for a terminal, but if you see "RAW" instead of "UTF8", you can set it manually:

$toJSON() escaped forward slash unnecessarily in 2016.1. It's valid JSON, but unconventional. %ToJSON() doesn't do this in 2016.2 and later. Depending on your data, you may be able to get away with $replace(json,"\/","/"). To handle all cases would be a bit more work.

The first $zf(-100) call doesn't work, because you're trying to redirect with the /STDOUT flag and the ">>" operator. You can do one or the other, but not both.

If you add the /LOGCMD flag to the second $zf(-100) call, you should see something like the following in messages.log:

    $ZF(-100) cmd=type "" file1.txt

I suggest that you not put an empty string in your options array.