Sorting PHRETS results and optional arguments

638 Views Asked by At

I am using PHRETS to make a search query but I am having trouble finding documentation on sorting the results.

Also, are there any other optional arguments besides "Limit"?

$results = $rets->Search("Property","RESI","(City=|Victorville,Hesperia,Apple Valley),(Status=|A)",["Limit"=>5]);

Thanks In Advance!

2

There are 2 best solutions below

0
On

I have gone through similar situation and what I did is splitting the query and loop through it, to get the partially sorted data. for eg: To sort your query by city, can split the query like this,

$results = $rets->Search("Property","RESI","(City=|Apple Valley),(Status=|A)",["Limit"=>5]);
$results = $rets->Search("Property","RESI","(City=|Hesperia),(Status=|A)",["Limit"=>5]);
$results = $rets->Search("Property","RESI","(City=|Victorville),(Status=|A)",["Limit"=>5]);

Then loop through these queries.

Similarly, we can split the query based on each year/month or based on any listing status etc.

Hope sorting option will be provided by RETS in near future.

0
On

The best location to find this information is by downloading the RETS official documentation for the RETS Server you are using (ex: 1.7.2).

This would be found here: https://www.reso.org/specifications/

In this documentation, which is under 7.4 Optional Request Arguments, all of the following are optional arguments:

Count, Format, Limit, Offset, Select, Restricted Indicator, Standard Names


For returning the results in a sorted order, the RETS spec does not have a way to do this, but future RETS specs may include this feature.