Hey Juan,

So at a guess - Intersystems is doing the thing where they just take whatever error you return, and tack on their own error on top of it.  In some cases they return all errors, and in others they just pick off the first one of them and return that (GetOneError or something similar).  This is a bug (in my opinion) - you should open a WRC ticket and have them fix it.  They might also be able to give you a workaround.


Good luck!

WHO DARES SUMMON ME!

Oh, hi Evgeny!  Great to see you, hope you're well!

For everyone else, Evgeny is right, of course (because he's quoting me laugh) but note that in newer versions (IRIS, for instance), you can make use of the %JSON.Adaptor to do something like:

Class Test.DoesItJSON Extends (%RegisteredObject, %JSON.Adaptor)
{
Property aString As %String;
Property anInteger As %Integer;
}

The do something like:

s obj=##class(Test.DoesItJSON).%New()
s obj.aString="Hello"
s obj.anInteger=123

d obj.%JSONExportToString(.jsonstring)
zw jsonstring
    jsonstring="{""aString"":""Hello"",""anInteger"":123}"

This is better for creating new classes (again in later versions than you're on, you need to use the jsonProvider or the altJsonProvider) that you think you're going to want to serialize into JSON.

In case you missed it below - @Vic Sun pointed out that the IRIS For Health docs should include all IRIS not-for-Health docs as well.  
 

While I agree with what a lot  of people said here - you probably should use the the expanded syntax - it doesn't exactly address the fact that it is much quicker (or FEELS much quicker) to type the abbreviations.  Especially when I'm in the coding groove and trying to get stuff done.  The fact is your IDE can can expand all the commands.  My take  is this: let your developers  do whatever makes their job easier.  It's easier to write shorthand, but read longhand - make a tool that converts shorthand to longhand and put that into your source control.

Maybe I should edit the title to say 16 years!!!

That's why I like to post stuff like this.  60 seconds of work that can save you hours of frustration are tricks worth knowing about.

@Vitaliy.Serdtsev  - you were right to summon me here!

SQL optimization is a HUGE topic (as has been mentioned) but InterSystems products are VERY good at JOIN-ing large tables.  Here's the issue, you're NOT doing a JOIN, you're doing a Cartesian Product.  Your query:

select o.col1, o.col2, op.partnum, op.amount
from orders o join orderpositions op
where o.orderDate > $H-1000

Is saying to JOIN EVERY order with EVERY order position over the last 3 years (give or take).  As you are not restricting how you're JOIN-ing the two tables together, there's not much we can do to optimize this.  That said, when bringing up these issues (and you should! either we help you write better code or we fix problems in our code!) you should provide your table definition and a query plan.  I think if you look at the query plan (which you can get from the management portal) you'll see that the problem is you're missing your JOIN condition (something like ON op.Order = o.ID, if I were to take a guess).  If that's not the case and this is the query you want to be running, please send over your class definitions by doing:

d $SYSTEM.OBJ.Export("User.orders.cls,User.orderpositions.cls","C:\Temp\KyleWantsThis.xml")

and I'll be happy to look at this further.  Of course, you are also very welcome to open up an issue with InterSystems Support - best support in the industry, and I'll bet a kidney on that statement.


 

To my knowledge you cannot do this on the client side, however it is easy enough to write a stored procedure to take in whatever input you want (say, a JSON object, or a list-of-lists, or some other data type) and use that to parse-and-INSERT on the server side.