StrataFrame Forum

Relationship Management

http://forum.strataframe.net/Topic4153.aspx

By Daniel Volz - 11/6/2006

Hello,

I try out Strataframe at the Moment and have an question. I want to create the following example:

Customers 1:n Orders

Orders 1:n OrderPositions

Articles 1:n OrderPositions

So i have to create two Relations in die OrderPositionsBO, but the wizard can only manage one Relation per BO, how can I write more than one Relationships in the same BO?

I have a SQL Server 05 and don't use die Database Employment Toolkit from Stratarframe.

best regards,

Daniel

By Daniel Volz - 11/6/2006

the next question i have concerns to the default values.

when I start the OrderMaintenance I dont want to choose the customer before I can fire a BOorder.add()
(because in a final application I have more than 800 tables and a lot of references and parent / childs, so I dont want to browse for 20 informations before I can create a new order.

The normal way for my customers is to click "New" and a empty order appears.
In the next step he choose a customer, then contact person, the delivery notes etc.

best regards,

Daniel

By Trent L. Taylor - 11/6/2006

There are several things you can do in regards to relationships.  In this case though, I do not think that you need to necessarily have a relationship between the two, but rather a Fill method that populates based off of the articles or the orders.  The parentRelationship property is for defining the foreign key parent that will be managed automatically by the framework when adding new records or populating strictly by the parent. 

In your case, you just have to foreign keys that will be populated differently based on whether you are wanting to use the articles or the orders.  Create two Fill methods in the business object and call whichever you need when  populating:

Public Sub FillByArticles(ByVal ArticlePrimaryKey As Integer)
   Me.FillDataTable("SELECT using the articles...")
End Sub

Public Sub FillByOrders(ByVal OrderPrimaryKey As Integer)
   Me.FillDataTable("SELECT using the orders...")
End Sub

The normal way for my customers is to click "New" and a empty order appears.

You can do whatever you want here.  Our Orders Entry example is not condusive to what happens in every business situation.  This just comes down to how you decide to program your form.  You can easily call the Add on the orders before you do anything else:

For example:

Orders.Add()

That is all you have to do in order to create your order record first.