Article
· Mar 8, 2023 2m read

The spooky ascetic Property

During my recent work on Tutorial - Working with %Query #1
I met a Class Property that is quite different from its same-named relatives.
It is there since 'ever' but is rarely used, Related doc doesn't help so much. 

A typical property in a class looks similar to this:

Property City as %String;

And you have a rich choice of additional settings to define it
and provide an initial value.
If you save it, it gets validated and stored
Inside a persistent class, you get its content back 
All well know features that don't require explanation to you as experts.

BUT:

If you declare a property to be MULTIDIMENSIONAL nothing is as before. 

Property ghost [ MultiDimensional ];

It starts at the creation of your Class instance - it is just not there
It is created at the first assignment of any value.
As you see it has no DataType - but you miss nothing as it is never validated
And you won't find all data-type-related implicit methods as LogicalToODBC or similar.

 

On the other hand, you can use all the ObjectScript-Functions that are not
available or allowed for standard typed Properties:

Modification with 

  • SET $BIT()
  • SET $EXTRACT()
  • SET $LIST()
  • SET $PIECE(). 
  • $DATA()
  • $GET()
  • $INCREMENT()
  • MERGE command
  • KILL

You just work with it like with a normal local variable in ObjectScript.
Multidimensional is a bit misleading.
You can create local variable arrays, but it is no requirement.

The price you pay for this freedom is:
 It is YOUR job to save/load it for persistence if required.
And to initialize and validate it with your own code,
 

Discussion (2)1
Log in or sign up to continue