Creating Related Record Question

I want to create a Related Record woth a relationship that has two match fileds.

Example:

Relationship: Orders_to_LineItems_By_Class

Orders LineItems

Order_ID (PK) = Order_ID
Service_Class = Service_Class

When I Try to create a related record via a portal I can see the Order_ID inserted correctly into the field in the LineItems Table.

elements.portal_Orders_to_LineItems_By_Class_70.newRecord():

I want to be able to have the Service_Class from the Orders table inserted into the LineItems table as well as the Order_ID.

I was hoping to do this using the above relationship, instead of adding more code.

I am sure I am missing something simple;

Thanks,
Erich

Taking a guess: have you tried Orders_to_LineItems_By_Class.newRecord() ?

In my experience, portals sometimes create more problems than they solve - AFAICT because the portal object itself is not ipso facto bound to a relation (all the portal elements are) - and the extra work of using a table-view form in a tab-panel is well worth the effort.

HTH,
Neale.

Yes I have tried creating the record directly, via the relationship, no luck.

It’s interesting you brought that up about related portals and tab panels. When I started using servoy I used to access related records through the relationship node, creating records, etc…

It seems that all the posts I see seem to use the element of the portal, or tab panel to access related records. I figured that there must be a better reason, but figured it should not make a difference.

So you have expeirenced issues using form elements V.S the relationship node?

Anyway, I guess I will just work around it, thats for the help anyway though.

it should insert both youre keys in the new record of youre relation.
Are you sure that you aren’t setting it youreself somehow
if i could see this behaviour in a solution then i can see what goes wrong.

I worked around it for now, but I will create a small sample when I have time, unless there is someting I am missing with the one line of code that create the record, then I should be able to easily recreate this when I have time.