db-discovered relation oddity/bug?

Using “Servoy R2 2.0 rc10 build-268 on Linux using Java 1.4.2_03”…

With a form based on tableA containing a portal with related records from tableB and a button in the portal invoking a method to go to the record view based on tableB using the discovered DB relation (forms.tableB_detail.controller.showRecords(db_tableA_to_tableB)) the displayed record in tableB_detail is always the first from the portal :-(

But, if the method is modified to use a manually created relation then the displayed record in the tableB_detail from is the “clicked on” record from the portal (as expected/desired).

Bug?

Thanks,
Neale.

There must be something else going wrong, the source from where the relation is created is irrelevant.
Please compare your tables/columns used in the relations you are talking about.

Yeah, “There must be something else going wrong” was my first reaction too. Unfortunately scrutiny of the relations etc doesn’t show up this other problem.

I’ve managed to sort-of replicate this in a test-case. Sort-of insomuch as in the test case it is the db-defined relation which is working as expected/desired but the manual relation which exhibits “surprising” behaviour. Definitely an unexpected twist.

The only common thread I can pick out is that in each case there are two identical relations (apart from name and manual/auto) defined and the first-defined one works as expected but the second-defined one doesn’t. Bizzare.

That help?

Thanks,
Neale.

I just cannot believe this is happening… could you sent a sample solution demonstrating this?

Yeah, I had trouble comprehending this one too (not sure what my fellow commuters on the train thoght was going on with the various expressions of puzzlement, confusion etc competing on my face last night).

Solution demonstrating this will be mailed separately.

Thanks,
Neale.

What you are trying todo cannot be done this way, you placed a portal based on a relation and added 2 button per row to go to child records via different relations, this is not possible becouse the form foundset record(not the portal) has two “the same” relations defined to a child table.
But when accessing a related foundset via a relation, those 2 relation definitions they result in separate objects (each such related foundset object had its own selected record)
The portal sets the selected record in one related foundset object (because its based upon that) but not in the other object it does not know of.
As a result the selected record in the other related foundset stays the first…
So to go to detail records you must use the same relation as where the portal is based on.
Or when needed to use different relation and willing to keep the selection use:

other_relation.recordIndex = db_relation.recordIndex;
forms.detailForm.showRecords(other_relation)