sorting order based on relationship
Archived from the Xataface Users forum.
Jean — Wed Sep 21, 2011 4:57 am
Hi Steve,
I have a relationship between 2 tables
- Code: Select all
lieu : id_lieu, nom programmation: id_programmation, id_lieu...
On my programmation list view, if I click on the id_lieu header, my items are sorted by id_lieu and not lieu.nom.
The relationships.ini is well set up…
My url is
- Code: Select all
-table=programmation&-sort=id_lieu
How can I sort by lieu.nom instead of programmation.id_lieu ?
Thank you
Jean
shannah — Wed Sep 21, 2011 9:36 am
Create a grafted field on your programmation table for this. Then hide the id_lieu in list view and show nom instead.
e.g.
- Code: Select all
- `sql = “select p.*, l.nom as lieu_nom from programmation p left join lieu l on p.id_lieu=l.id_lieu”
[lieu_nom]
order=10[id_lieu]
visibility:list=hidden`
-Steve
Jean — Wed Sep 21, 2011 10:01 am
thank you Steve for your explanation, I’ll add it in the wiki.
Jean