- Log in to post comments
I'm currently a developer for the InterSystems iService customer support platform. As such, I've become an expert in the Angular framework and how that can integrate with the IRIS database.
In my free time, I am a musician (trumpet player for 25 years) and avid gamer.
Agreed. There's a few things when working with JSON that I feel could be made to bridge the gap between COS and the Javascript nature of them, and that's certainly one of them. The difference in array indexing always throws me off as well, which is why I wish that we could use [] array indexing when working with Dynamic Arrays rather than having to use %Get() as I feel like I'd be able to more naturally make the jump between the 0-indexed Dynamic Arrays that way.
- Log in to post comments
It's definitely situational for me. I generally try to avoid using Quit for situations where I am trying to exit the method or program entirely, and opt for Return in these cases (a habit which took a lot of retraining since I'd been used to using quit for everything coming from a heavy MUMPS-coded software base in the past). I really only use Quit these days for terminating a loop when needed, but it's still a common enough usage for me.
In short, these days I use these rules:
- Return - Exit program/method (with or without return value)
- Quit - Loop terminator
- Log in to post comments
You can also shorthand the ObjectScript call to %FromJSON() by using:
set list = [].%FromJSON(jsonExport)
or
set list = {}.%FromJSON(jsonExport)
When you set an ObjectScript variable equal to either [] (DynamicArray) or {} (DynamicObject), the variable becomes an instance of the respective dynamic entity class automatically, so it saves you having to type out the entire class reference.