Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Question Evgeny Shvarov · Oct 21, 2022

What is The Global With Persistence Data For A Class?

Hi Devs!

Is there a way to get a Global that contains pesistence data for a class?

In early versions of IRIS it was classname_"D", like ^Sample.PersonD. Now, at least in IRIS 2022.1  it is something random.

Product version: IRIS 2022.1

Comments

Danny Wijnschenk · Oct 21, 2022

When doing a create table, it is indeed a hashed global name, but when defining a new class in Studio, it is still clasname_"D" (unless the global name becomes too long).

The parameter USEEXTENTSET=1 will alter this behaviour (in class definition or CREATE table statement) :
Global Naming Strategy: you can use the USEEXTENTSET parameter to specify shorter and more efficient hashed global names for data and index lookup operations.

You can use %Library.CompiledStorage to find out what the global name is for a class : https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic…

0
Danny Wijnschenk  Oct 21, 2022 to Evgeny Shvarov

I added the way to find out which global name is used in my first reply  : try
 

write ##class(%Dictionary.CompiledStorage).%OpenId("MyPackage.MyClass||Default").DataLocation
0
Vitaliy Serdtsev · Oct 24, 2022

There is a faster way without opening the object:

<FONT COLOR="#000080">Class dc.test Extends %Persistent
</FONT><FONT COLOR="#000000">{

</FONT><FONT COLOR="#000080">ClassMethod </FONT><FONT COLOR="#000000">Test() {      </FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">classname</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"dc.test"</FONT><FONT COLOR="#000000">, </FONT><FONT COLOR="#800000">storagename</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"Default"   </FONT><FONT COLOR="#0000ff">w $$$defMemberKeyGet</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">classname</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$cCLASSstorage</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#800000">storagename</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#0000ff">$$$cSDEFdatalocation</FONT><FONT COLOR="#000000">) }

</FONT><FONT COLOR="#000080">Storage </FONT><FONT COLOR="#000000">Default { <Data name="</FONT><FONT COLOR="#000080">testDefaultData</FONT><FONT COLOR="#000000">"> <Value name="</FONT><FONT COLOR="#000080">1</FONT><FONT COLOR="#000000">"> <Value>%%CLASSNAME</Value> </Value> </Data> <DataLocation>^abc.1</DataLocation> <DefaultData>testDefaultData</DefaultData> <IdLocation>^dc.testD</IdLocation> <IndexLocation>^dc.testI</IndexLocation> <StreamLocation>^dc.testS</StreamLocation> <Type>%Library.CacheStorage</Type> }

}</FONT>

Result:

^abc.1

0
Alexander Koblov · Oct 24, 2022

In System Explorer -> Globals check "Show SQL Table Names". You'll see information on how particular global is used.

0