Creating Class With a Certain Global Name For Data Storage
Hi developers!
As you probably noticed in IRIS 2021 the names of globals are random.
And if you create IRIS classes with DDL and want to be sure what global was created you probably would want to provide a name.
And indeed you can do it.
Use WITH %CLASSPARAMETER DEFAULTGLOBAL='^GLobalName' in CREATE Table to make it work. Documentation. See the example below:
CREATE TABLE Sample.Person (
Surname VARCHAR(50) NOT NULL,
Name VARCHAR(50)
) WITH %CLASSPARAMETER DEFAULTGLOBAL = '^Sample.Person'
This will generate the global storage of:
Storage Default
{
<Data name="PersonDefaultData">
<Value name="1">
<Value>Surname</Value>
</Value>
<Value name="2">
<Value>Name</Value>
</Value>
</Data>
<DataLocation>^Sample.Person.1</DataLocation>
<DefaultData>PersonDefaultData</DefaultData>
<ExtentLocation>^Sample.Person</ExtentLocation>
<IdFunction>sequence</IdFunction>
<IdLocation>^Sample.Person.1</IdLocation>
<Index name="DDLBEIndex">
<Location>^Sample.Person.2</Location>
</Index>
<Index name="IDKEY">
<Location>^Sample.Person.1</Location>
</Index>
<IndexLocation>^Sample.Person.I</IndexLocation>
<StreamLocation>^Sample.Person.S</StreamLocation>
<Type>%Storage.Persistent</Type>
}
Notice, that the data global is not ^Sample.Person, but ^Sample.Person.1