First time here? Check out the FAQ!
0

Order By query in phRETS

RETS URL : http://maxebrdi.rets.fnismls.com/Rets... Username: CCAR_Mooveguru

I want to search data using "Order By" for ex. Order By L_ListingID Desc. Can you tell me how can I write a DMQL2 query for that in phRETS?

Thank you in advance.

chaitanya's avatar
chaitanya
asked 2018-02-14 11:19:49 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

RETS doesn't have an Order By option. Paragon RETS returns data in Key Field order. So for the property resource, it would be ordered by L_ListingID asc.

bwolven's avatar
bwolven
answered 2018-02-14 11:47:20 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

I asked the same question because in SQL you can, but in DMQL you cannot, as was stated. However, there is an easy method and answer for you, by using one of PHP's library of sort functions. You can sort the entire returned array by a specific KEY.


SINGLE KEY: ASC (List of Cities)

If you want to get a list of cities your MLS serves, you can sort that list alphabetically with ASORT() to sort from LOW to HIGH (or think alphabetically):

asort($cities);

MULTIPLE-KEYS: DESC (Newest Listings First)

To order a list of properties, with multiple keys (fields), in the order of most recently listed, you sort the list with ARSORT() which is from NEWEST to OLDEST (HIGH to LOW).

array_multisort($tempArray['Date_Listed'],SORT_DESC,SORT_LOCALE_STRING,$listings);

MULTIPLE-KEYS: ASC (Lowest Priced Property First)

To a list of properties containing (Address, City, Asking_Price), in lowest price order, your code would be:

array_multisort($tempArray['Asking_Price'],SORT_ASC, SORT_NUMERIC,$listings);

ABOUT: tempArray

You will need to parse your array into one or more tempArrays using a FOR / EACH loop. Then use these tempArrays in yourarray_multisort() lines. I only showed an example of using a single KEY in a multi-key array.


RESOURCES

DACO's avatar
DACO
answered 2018-08-09 08:29:01 -0500, updated 2018-08-09 09:01:12 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer