Sorting Relationships

A place for users and developers of the Xataface to discuss and receive support.

Sorting Relationships

Postby mikep » Thu Jan 14, 2010 1:51 pm

I am trying to sort the records in my relationship tabs. I tried the following statement

SELECT * from Progress_Notes where Client_ID='$Client_ID' ORDER BY Client_ID DESC, Date DESC

but it didn't work. I'm assuming ORDER BY clauses are not supported in Xataface relationships.

How do you go about sorting records in a relationship?

Thank you,
Mike
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm

Re: Sorting Relationships

Postby shannah » Thu Jan 14, 2010 2:20 pm

Yes. You should not include an order by clause in a relationship definition. Sorting is done at a higher level. E.g. click on the column headings in your relationship tabs. You'll notices that it adds something like -related:sort={column name} to the url.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Sorting Relationships

Postby mikep » Sat Jan 16, 2010 1:48 am

Hi,

I tried adding this to my index.php

if ( !isset($_REQUEST['-sort']) and @$_REQUEST['-relationship']=='Table_Name' ){
$_REQUEST['-sort'] = $_GET['-sort'] = 'Client_ID desc, Date desc';
}

But it didn't seem to work. Where and how can I modify the link for this relationship?

Thanks,
Mike
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm

Re: Sorting Relationships

Postby shannah » Sat Jan 16, 2010 9:33 am

For relationships, it doesn't use the -sort parameter. It uses the -related:sort parameter.
If you click on a relationship tab and then sort the records by clicking on a column header you'll see what this parameter looks like in the query string.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Sorting Relationships

Postby mikep » Sat Jan 16, 2010 9:49 am

Ah, thanks. I was only looking at the link for the relationship tab.


Mike
mikep
 
Posts: 44
Joined: Fri Apr 24, 2009 2:21 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved