Nice Tips & Tricks list! 🙂
Very useful.
Regarding #10 "Converting JSON array (%DynamicArray) to a comma-separated string and back:"
USER>Set jsonArray = ["test1","test2","test3"]
USER>Set str = $TRANSLATE(jsonArray.%ToJSON(), "[]")
USER>w str
"test1","test2","test3"The returned is not really what I consider a "comma separated string".
To return my definition of "comma separated string" it would be:
USER>Set str = $TRANSLATE(jsonArray.%ToJSON(), """[]")
USER>w str
test1,test2,test3Then, going back...it's another story 😉
Regarding #2 "Error check when we use Embedded SQL (&sql())"
In addition to error code and description it's often useful to get/include error details, like:
Return:SQLCODE<0 $$$ERROR($$$GeneralError, $$$FormatText("Operation failed. SQLCODE = %1: %2 (%3)", SQLCODE, $SYSTEM.SQL.Functions.SQLCODE(SQLCODE),%msg))- Log in to post comments
