Enhance Parent/Child to use only business objects


Author
Message
Jim Schepflin
Jim Schepflin
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: Forum Members
Posts: 25, Visits: 64
Have a scenario where I need to enforce a parent/child relationship using a calculated field (Actually determined through another business object, so using database lookups etc).



It's actually an unchangeable parent, then a "linking" child, then the "real" child (Header goes to 0..1 linkers goes to 0..1 data elements)



Header has 2 pieces of info, one being a "Database Name/ServerName" lookup (I need to be able to handle same id within different databases, and at the same time don't want to encode the server/database within each row, make it a nightmare to move).



So tried setting up the relationship through the spiffy UI, it doesn't let me, since the business objects are in different databases (To add to the fun)



And the "ERPSystemKey" (Really a guid stored in another db, through gets / save once) failed due to "ERPSystemKey not found in table" (It's not in there, I know that, there was a fair bit of code to get it set!)



So desire is to allow any fields that I have definied within the business object to be used to link the business objects, and not be dependent on the table structure
Replies
Jim Schepflin
Jim Schepflin
StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)StrataFrame Novice (95 reputation)
Group: Forum Members
Posts: 25, Visits: 64
Don't suppose you have an example of using this attribute? I tried a couple of things, didn't compile.



Exact error occurs when assigning



Error:

Column 'ERPXrefKey' does not belong to table Inventory.

hier_Inventory_SOLBO1.ParentBusinessObject = inventory_ERP_SOLBO1;



Relationship had been set up through code:

MicroFour.StrataFrame.Business.BusinessParentRelationship oHierInvRel = new MicroFour.StrataFrame.Business.BusinessParentRelationship();

oHierInvRel.ForeignKeyField = new string[] { "ERPXrefKey", "InvtID" };

oHierInvRel.ParentPrimaryKeyField = new string[] { "ERPXrefKey", "InvtID" };



oHierInvRel.ParentBusinessObjectType = "HierBO.Inventory_ERP_SOLBO";

hier_Inventory_SOLBO1.ParentRelationship = oHierInvRel;

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
In these two lines of code:

oHierInvRel.ForeignKeyField = new string[] { "ERPXrefKey", "InvtID" };
oHierInvRel.ParentPrimaryKeyField = new string[] { "ERPXrefKey", "InvtID" };

do those fields belong to both tables (i.e. a compound primary key?)  If not, then you only want to specify the field once in the definition.  For instance, I have a table Customers with pk=cust_pk and a table Orders with a foreign key to Customers called or_cust_pk.  The relationship would look like this:

BusinessParentRelationship myRel = new BusinessParentRelationship();
myRel.ForeignKeyField = new string[] { "or_cust_pk" };
myRel.ParentPrimaryKeyField = new string[] { "cust_pk" };
myRel.ParentBusinessObjectType = "MyNamespace.Customers";
myOrder.ParentRelationship = myRel;

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search