.ParentRelationship property (changing programmatically)


Author
Message
Charles Thomas Blankenship...
Charles Thomas Blankenship
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K

Executive Summary:

 

How do I dynamically/programmatically change the .ParentRelationship property on an ASPX codebehind page as it loads?

 

Details:

 

I thought I would be able to populate the ParentRelationship property dynamically using the string that appears after using the builder … unfortunately though, as my accounting teacher stated, “Ignorance is bliss … but only for a time”.

 

 

MailAddr.ParentRelationship = "Person, (iID) <--> (iPersonFK)"

 

MailAddr = "Company Location, (iID) <--> (iCompanyLocationFK)"

 

MailAddr.ParentRelationship = "Courthouse, (iID) <--> (iCourthouseFK)"

 

MailAddr.ParentRelationship = "Employee, (iID) <--> (iEmployeeFK)"

 

MailAddr.ParentRelationship = "Investigator, (iID) <--> (iInvestigatorFK)"

 

Further testing simply served to illustrate the level of my ignorance … not to mention short lived blissfulness.  I soon

discovered that this property is really a reference to an object of the following nature:

 

MicroFour.StrataFrame.Business.BusinessParentRelationship

 

A short hunt through the code brought me to this Public Interface:

 

Namespace Business

 

Public Interface IBusinessParentRelationship

 

#Region " Properties "

        Property ParentBusinessObjectType() As String

        Property ParentPrimaryKeyField() As String()

        Property ForeignKeyField() As String()

#End Region

 

#Region " Methods "

        Function Clone() As IBusinessParentRelationship

#End Region

 

End Interface

 

End Namespace

 


At this point, my ignorance kicked in again and I was hopeful that I could simply assign a string to these properties and

then assign that object to the .ParentRelationship property of the MailingAddress business object.  Silly boy … as

“value of type string cannot be converted to a one dimensional array of string”.  Sigh

 

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

Ok, I says to myself … much less confident in my ability to do anything at this point other than poo in my shorts … let’s try this:

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField(0) = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

But, alas, no, as it is obvious I don’t know how to deal with one dimensional arrays of type string.

 

So, I fall back to your expertise.  How do I dynamically change the .ParentRelationship property on an ASPX page?

 

 

CT

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com

Charles Thomas Blankenship...
Charles Thomas Blankenship
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K

How do I dynamically/programmatically change the .ParentRelationship property on an ASPX codebehind page as it loads?

 

Should read:

 

How do I dynamically/programmatically change the .ParentRelationship property of a child business object on an ASPX codebehind page as it loads?

 

Thanks,

 

CT

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Oh, CT, you are so close Smile

You only need to change the strings to read like this:

New String() {"Value"}  '-- Creates a new string array with only one element

So, this:

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = "iPersonFK"

oPersonMARel.ParentPrimaryKeyField(0) = "iID"

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel

 

Should be this:

 

oMailingAddress.ParentBusinessObject = oPerson

 

Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship

 

oPersonMARel.ForeignKeyField(0) = New String() {"iPersonFK"}

oPersonMARel.ParentPrimaryKeyField(0) = New String() {"iID"}

oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person"

 

oMailingAddress.ParentRelationship = oPersonMARel


Jim Schepflin
Jim Schepflin
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 25, Visits: 64
Here is a C# example, including use of 2 keys in the relationship:





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

oPersonMARel .ForeignKeyField = new string[] {"Field1ofKey", "Field2ofKey"};

oPersonMARel .ParentPrimaryKeyField = new string[] { "Field1ofKey", "Field2ofKey" };



oPersonMARel .ParentBusinessObjectType = "IMA.BOLibrary.Person";

oMailingAddress.ParentRelationship = oPersonMARel



oMailingAddress.ParentBusinessObject = oPersonMA





Just may make life a bit easier for next person to do this

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