I am displaying all the related records in a Table View.
But when I am executing the above code it is giving the wrong order. But when I am clicking the Header of the Field(company_id), It is giving the correct result.
But the correct sort of records can’t be achieved by the above code.
I have a second problem: I like to make an initial sort. I would like to sort the same attribut (name) via 2 different relationships. In the Property Editor window, when double clicking on the InitialSort property on the forms, the relationship is NOT shown, only the attribute. If I like to make an initial sort like
Joas:
If you use [relation].sort(), you’re already working through the relation, so you don’t need to specify it again when addressing the field names:
Yep, I have the relation, but i want to sort the related records(filtered by the same relationship) based on a Field of the table on which the relationship is based upon.
ars:
Aah, that will work if we sort the real field not through the related Field.
This will solve the issue.
tbl_a_to_tbl_b.sort('company_id asc');
That’s what I was telling you, but you edited my post when quoting
Robert Huber:
Initial Sort remains a problem. How to do in Initial Sort what I achieve with the above code?
It is true that you can’t select the same field of the same table more than once in the initialSort dialog. You should do a feature request if you want this.
For now you can execute your code in the onLoad method to get the same result.
Yes, I need that functionality, so I will make a feature request. The use of an onLoad method is as you say for now a workaround.
Thanks and best regards, Robert
Robert Huber:
Initial Sort remains a problem. How to do in Initial Sort what I achieve with the above code?
It is true that you can’t select the same field of the same table more than once in the initialSort dialog. You should do a feature request if you want this.
For now you can execute your code in the onLoad method to get the same result.[/quote]