Question
CM Wang · Aug 18, 2017

%Dictionary.StorageSQLMapDefinition

I want to manipulate all the objects whose type is%Dictionary.StorageSQLMapDefinition by %OpenId

However, I don't know the exact id to feed into %OpenId, is there a way to query all the existing ids of %Dictionary.StorageSQLMapDefinition in a namespace?

Thanks.

0
0 304
Discussion (3)2
Log in or sign up to continue

Yes:

select ID from %Dictionary.StorageSQLMapDefinition

If I may ask - why?

ID value contains all pieces of the primary key separated by ||. In the case of %Dictionary.StorageSQLMapDefinition it's:

Class||Storage||SQLMapName

So to open %Dictionary.StorageSQLMapDefinition you need to either construct an ID like this:

Set Class = "%CSP.Util.Performance"
Set Storage = "CspPerformance"
Set SQLMapName = "Map1"
Set Id = $LTS($LB(Class, Storage, SQLMapName), "||")
Set Obj = ##class(%Dictionary.StorageSQLMapDefinition).%OpenId(Id)

Alternatively you can use Open method for IDKEY index (more on auto-generated methods for indices, properties etc.):

Set Obj = ##class(%Dictionary.StorageSQLMapDefinition).IDKEYOpen(Class, Storage, SQLMapName)

What's your big picture problem you're trying to solve? There might be better ways to do that.