User bio

The first two systems I worked with using InterSystems technology were a PDP-11 running M11+ and a VAX 11/750 running M/VX. Too many years ago to count! 😊
Since then I've used most, if not all, InterSystems products up to IRIS and HealthShare today.
I'm Italian living in Switzerland and I work as Senior Consultant at GAIVOTA consultin SA, we provide professional services for InterSystems and other technologies.
Curiosity: apart from DC, I don't have ANY social account! 😁

Show all
Member since Aug 4, 2017
Replies:

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,test3

Then, 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))

For example, if you instruct it to extract data where a column value equals “Support,” it may generate a condition like = 'Support' in the SQL query.

However, since the actual returned value is “SUPPORT,” the condition does not match.

Not really, when using the default %String collation (SQLUPPER) the SQL "=" condition is case insensitive, for example:

WHERE name = 'Enrico'
WHERE name = 'ENRICO'
WHERE name = 'enrico'

All match the record/row with my name regardless of the case is stored in the table.

If collation is changed to SQLSTRING, then only exact case will match the condition.

Certifications & Credly badges:
Followers:
Following:
Enrico has not followed anybody yet.