User bio
404 bio not found
Member since Feb 2, 2016
Replies:

The %DynamicAbstractObject (%DAO) subclasses, including the %DynamicArray and %DynamicObject classes, provide the best way to read/send JSON representation into/out-of IRIS databases.

The %FromJSON method can create a tree of %DAO objects from external JSON representation.  Then elements of %DAO data can be read or accessed using ObjectScript property syntax and using methods like %Get and %GetIterator.

Data inside an IRIS database can be used to build a tree of %DAO objects by using the ObjectScript JSON constructor syntax, property assignment statements and using methods like %Set and %Push.  If all you do is store values into previously undefined elements of a %DAO object then the performance is usually quite good.  Then that %DAO tree can be turned into JSON representation using the %ToJSON method.

It is not recommended that data in a tree of %DAO objects be extensively and repetitively modified/updated by the %Set method or by other ways that can modify data in a %DAO.  This is especially true if you are repetitively changing the size of data elements.  In such cases, the data in %DAO objects should be extracted and converted to some other optimized database structure.  Often this can be Relational DataBase access if a mix of rectangular arrays provides the desirable access.  It can be a %Stream if sequential access is needed.  If a number of data elements are to be searched then columnar vectors can be used.  IRIS can supply all these other access methods by layering them on top of ObjectScript multi-dimensional arrays.  The IRIS multi-dimensional arrays (both global and local) provide the best tradeoffs across a large variety of differently ordered read/write/update/modification operations.

If you have data in a %DAO tree and you need to make small or infrequent modifications of the data then it is acceptable to leave it in %DAO representation.  You can also make repetitive reads of %DAO data without needing to convert to some other representation.  But otherwise, %DAO objects are best limited to moving data into and out-of JSON representation.

Assuming  that response.message_code is part of an ObjectScript expression then you want to evaluate response."message_code" because _ is an ObjectScript operator so you must quote "message_code" to change it into a method or property name.  Otherwise, _ is the string concatenation operator so the value of response.message will be concatenated with the value of code.

I agree that LOG^%ETN, and ^%ETN as a process terminating trap routine, are the best way to log problems.  But we should also mention that DO ^%ERN is the utility that will dump the data that LOG^%ETN places in the ^ERRORS multi-dim global.  That dump includes state information, a complete call-stack dump, a list of all active local variables at each stack level, and in recent IRIS releases, it also includes a dump of all Class Objects with an oref active in memory.  This is a lot of information for each ^ERRORS entry so you might not want to be over-enthusiastic with your calls on LOG^%ETN.

Certifications & Credly badges:
Steven has no Certifications & Credly badges yet.
Global Masters badges:
Steven has no Global Masters badges yet.
Followers:
Following:
Steven has not followed anybody yet.