RETS DMQL basics for WP-Property Importer

If you are bewildered by XPath semantics you'll learn that DMQL is even stranger. DMQL is a query language required by most RETS providers. The first step you should take before writing a DMQL query is take a look at the fields used by your MLS provider, you may do so at http://retsmd.com/, provided you have login credentials. Once you have logged into your RETS provider navigate to a Property Classification of your choice.

Establishing a Connection

In order to connect your XML Importer schedule to an MLS provider you will, in most cases, need to enter in some "mapping" information to let XML Importer know which fields in your MLS provider's RETS data correspond to necessary WP-Property fields. Unfortunately this step must be performed manually because naming conventions vary from one MLS provider to the next.

  • Property data is almost always found under the "Property" data type which breaks down further into "Classifications", in this case "REN" classification corresponds to "Rentals" and "RES" corresponds to "Residential". The naming conventions will vary from one providers to the next. 

    

  • The "SystemName" column displays a list of available fields, these are the fields you must use within DMQL queries as well as Attribute Mapping. 

  • You will need to fill out several fields within XML Importer to establish a connection to your RETS provider as well as select a particular property classification. The screenshot below is a quick overview of which fields are mapped where.

Date Ranges

To limit listings to a particular date range, perhaps if we only want to fetch active listings that have been modified after August of 2013, the following query would do just that:

(STATUS=A),(DATE_MODIFIED=2013-08-01+) The previous query will import all listings modified after August 1st, you could otherwise limit by a specific range, let's say all of July: (STATUS=A),(DATE_MODIFIED=2013-07-01-2013-08-01) Lastly, if you don't care about fetching Active listings, and only care about the time-frame, your query would be as follows: (DATE_MODIFIED=2013-07-01-2013-08-01) We could also restrict our import to the number of photos a listing has - assuming that the provider has a "PHOTO_COUNT" field the following DMQL query will only import listings that have between 2 and 5 photos: (STATUS=A),(PHOTO_COUNT=2-5)

Addresses

Most MLS providers have a number of fields corresponding with different sections of an address - e.g. "Street Number", "Street Name", "City", etc. To reduce the number of attributes it is recommended to concatenate all the address fields into a single field and let WP-Property handle the geolocation (via Google Maps API) upon import.  So, assuming that your provider uses "STREET_NUM", "STREET_NAME", "CITY", "STATE" and "ZIP" fields, the following Attribute Map entry will easily concatenate (combine) the separate fields into a single "Address" field: concat:'STREET_NUM' 'STREET_NAME' 'STREET_DIR', 'CITY', 'STATE' 'ZIP'When the listing is imported, WP-Property will perform a "Geolocation Lookup" which will fetch the latitude, longitude, county, etc. fields from Google Maps and save the values into the listing.

Best Practices

This is a brief summary of common best practices with importing RETS listings into WP-Property.

  • Use the MLS Number as the Unique ID Attribute. 
  • Concatenate certain values within the XPath rule. For example, "Half Bathrooms" and "Full Bathroom" could be concatenated and saved to "Bathrooms" with the following rule: concat:'BATHS_HALF' / 'BATHS_FULL'
  • Do not set the "Property Type" attribute in the Attribute Map. MLS data often has arbitrary property types and it's best to configure the property type for all listings within a schedule by setting the "Default Property Type"