I think the solution for your problem is to use a one-many relationship. This will use a separate storage for the many-objects, allowing you to define the complete IdKey.
Georg
Kristian Kalweit wrote:
Hallo,
I need the exact way to build the id of an object, to know if the object already exists in the database (I want to call %ExistsId).
As far as I know the last part of the Id is an auto generated number or the properties of the Idkey index, delimited with ||. The first case (auto generated) is not of interest, because I use always an Idkey index. With %Dictionary.CompiledClass I can get the properties of the index and can build this part of the Id without any problems.
Problems occur if there is a relationship to a parent in the class. Cach� extending the Id automatically with the Id of the parent object. I tried to add the relationship to the Idkey index. Doesn't compiling: "ERROR #5514 Map expression - unknown or invalid field: Package.PClass.ParentR"
Property Nr As %Integer; Relationship ParentR As Package.PClass [ Cardinality = parent, Inverse = ChildR ]; Index MainIndex On (ParentR, Nr) [ IdKey, PrimaryKey, Unique ];
Do I have to search for relationships to parents by myself and add it to the id? Or ist there a common way to build the id?
Regards.
