>>>When a grid contains child records, is there a way to present them in an order different from the index upon which the relationship is based? Say the relationship is based on customerID but we want the child records to be presented in decending order by date.
>>>
>>>Thanks
>>
>>You can use compound index if you'd like to use relationship. The simpler solution will be using CA or parameterized view and requery when the parent CustomerID changes.
>
>Thanks Naomi -
>No luck with a compound index. If the relationship fields are character but the desired sort order is integer, what would the index expression look like? I tried keyfield + str(sortfield) but this didn't work. So I thought I would try the view (no experience there). Do we set up the view as the source for the entire form (both tables) or just for the grid (child table)? I tried it both ways and didn't get very far.
You need a view just for the grid.
The view will be
select * from Child where CustomerID = ?m.CustomerID order by DateFld DESC
For compound index it will be
KeyField + str(2147483647 - IntField) && or just (-1)*IntegerField -- to sort in desc order
If it's not broken, fix it until it is.
My Blog