scenario:
on a list form i use a button to display a detail form (same foundset) here is the method:```
forms.myForm.controller.show();
apparently everything is working properly.
On ANOTHER list form (displaying another table) i use a button to go to the SAME detail form above, here is the method:
var current = currentcontroller.recordIndex;
forms.myForm.controller.showRecords(databaseManager.convertFoundSet(foundset, releationName));
currentcontroller.recordIndex = current;
apparently everything is working properly.
But now as i get back to the previous list form it seems that hitting the display detail form button is unable to open the right record, it's some sort of a random one.
Any idea about what could be wrong?
thanks
Hello,
So you have table A and table B
The first operation takes place in table B list view and simply goes to a table B form view displaying that chosen record.
Simple, straight forward and it works !
The second process takes place in table A list view and attempts to display a table B form view via the relationship between table A and table B
So far, so good !
Now, you seem to be storing the record index of the chosen table A record which was clicked and then isolating the related records from table B (for the current foundset of table A), displaying the form and then going to the record index stored from table A !
Here I am confused.
If you have a one to many relationship between table A and B then there is very little likelihood that there will be the same number of records in table B foundset as there is in table A foundset and so there would be no correlation between the record index taken from table A and the record index that you arrive at in table B
Second, if there is an enforced one to one relationship between table A and table B then there may still be differences in the logical order that the records have which still means that there is no correlation between index in table A and index in table B.
So record number 2 in table A foundset may OR may not be related to record number 2 in the related foundset !
Does this make sense as I may not be explaining myself well here !
If either case exists in your scenario then you would be better served taking the PK of the parent record and then isolating that specific related record or records in table B
If I am incorrect then please tell me where I have gone wrong
Cheers
Harry
thanks Harry,
that does make sense.
Harry Catharell:
…
you seem to be storing the record index of the chosen table A record which was clicked and then isolating the related records from table B (for the current foundset of table A), displaying the form and then going to the record index stored from table A !
…
If you have a one to many relationship between table A and B then there is very little likelihood that there will be the same number of records in table B foundset as there is in table A foundset and so there would be no correlation between the record index taken from table A and the record index that you arrive at in table B
i agree, the recordindex is not the way to go.
If either case exists in your scenario then you would be better served taking the PK of the parent record and then isolating that specific related record or records in table B
I have a many to one relation from table A to table B, so what i need is to list all the related records in table B, while displaying the related one i clicked.
So, at the moment the problem is that i am not able to figure out the way to solve it, i’m probably missing something basic here.
something like this:
var currentPK = releationName.pkcolumn;
forms.myForm.controller.showRecords(databaseManager.convertFoundSet(foundset, releationName));
forms.myForm.controller.foundset.selectRecord(currentPk);
But remember if the total foundset is greater then 200 and the currentPK is not in those 200 then it won’t select it right now.
Therefore if you really want to select it you have to test if that pk was selected something like:
if(forms.myForm.pkcolumn != currentPk)
{
forms.myForm.controller.setSelectedIndex(forms.myForm.controller.getSelectedIndex);
forms.myForm.controller.foundset.selectRecord(currentPk);
}