- Log in to post comments
Nice clear description Benjamin. This should be a big help for query performance. It is such a common problem in support when we have to help customers deal with outliers. Now the RTPC should do that work for them!
- Log in to post comments
So there is a zip file attached to this article that contains a bunch of examples. the Class Mapping.ChildPiece should be close to what you need. the global for that class Parent Child looks like this:
/// ^Par(1)=Parent1\Child11#child12#child13
/// 2)=Parent2\Child21#child22
/// 3)=Parent3
///
and the mapping for the child is:
<SQLMap name="Map1">
<Data name="ChildData">
<Delimiter>"^"</Delimiter>
<Piece>1</Piece>
</Data>
<Global>^Par</Global>
<RowReference>$P($P(^Par({L1}),"\",2),"#",{L2})</RowReference>
<Subscript name="1">
<Expression>{Mapping.ParentPiece.Sub1}</Expression>
</Subscript>
<Subscript name="2">
<AccessType>Piece</AccessType>
<Delimiter>"#"</Delimiter>
<Expression>{PieceCounter}</Expression>
<Invalidcondition name="1">
<Expression>$P(^Par({L1}),"\",2)=""</Expression>
</Invalidcondition>
</Subscript>
<Type>data</Type>
</SQLMap>
If you can get your working let me know and I can make an example for your global.
Brendan
- Log in to post comments
Craig
If you are defining a Parent-Child Relationship with Default Storage the global structure of the child with change from ^child(id) to ^child(parentid,id) so you will not see any of the old data, no hint will fix that issue, sorry.
If your current child data is valid and you want to keep it I would suggest defining a Foreign Key constraint with Cascade on Delete. This will keep the global structure the same but let you enforce your relationship.