Search code examples
javascriptdatabaseretsdmql

datetime field record exists but querying shows no record (DMQL)


I am making an api call to a db which requires using dmql to do queries.

https://www.flexmls.com/developers/rets/tutorials/dmql-tutorial/ I have been following this tutorial on how to query, everything works fine until I am trying to query a datetime_field

I am so sure the record exist because at first I used '*' as my querying field which returns EVERYTHING. So I took the first record to do my testings.

For sure the record's field name and value is such "L_UpdateDate": "2018-12-05T08:07:59.9",

so for my querying I did and none of these works

(L_UpdateDate=2018-12-05T08:07:59+)
(L_UpdateDate=2018-12-05T08:07:59.9)
(L_UpdateDate=2018-12-05T08:07:59.9+)
(L_UpdateDate=2018-12-01T00:00:00+)

somehow this works though but of course the result isn't what I wanted

(L_UpdateDate=2018-12-05T08:07:59-)

not sure if any other coding I should show here since everything works fine, even if I try to use other fields to query. Just with this datetime isn't working as expected.

Thanks in advance for any help / suggestions.

PS. I did see this post http://vendorsupport.paragonrels.com/question/4196/datetimeyyyy-mm-ddthhmmss-syntax-returns-no-results/

which suggest because url encoding which I did forget about it so I added it on which does not help either.

This is what I have done filter: encodeURI(filter) which would be like filter: encodeURI('(L_UpdateDate=2018-12-05T08:07:59%20)') and after encoded, it's filter: '(L_UpdateDate=2018-12-05T08:07:59%20)'

this does not work too :(


Solution

  • The encoded string you are showing has %20 which is a space, not a plus.

    So it does appear that you are facing the same Problem as in that big report - fix the way you encode URLs, and make sure the plus gets encoded correctly as %2b

    Make sure to fix the encoding at the right place - at the end, not a dict - so you also don't get double encoded versions.