Kirstian You can do what you want
Property Nr As %Integer; Relationship ParentR As Package.PClass [ Cardinality = parent, Inverse =ChildR ]; Index MainIndex On Nr [ IdKey, PrimaryKey]; Should work also you need to have on compile dependent classes and make sure the parent is saved after adding the relationship Peter On Wed, 28 Apr 2004 08:36:11 +0200, "Kristian Kalweit" <[EMAIL PROTECTED]> 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. >
