[libRETS-users] Searching with librets and .net

328 views
Skip to first unread message

Alex Hawkins

unread,
Nov 21, 2011, 1:31:23 PM11/21/11
to For and help for and by the users of the libRETS C++ library
I am back again, again thanks to all who helped me log in. Now I just need some simple syntax advice from you. I am searching this Rapattoni server (or attempting to) simply to get a feel for the grander picture.
I have some code like this:
 
dim searchUrl as string = response.getsearchurl()
dim sr1 as searchrequest = session.CreateSearchRequest("PROPERTY", "RESI", "(ZipCode=40342), (Status=Active)")
 
sr1.SetStandardName(False)
sr1.SetSelect("ListingPrice, Bedrooms, City")
sr1.SetLimit(SearchRequest.LIMIT_DEFAULT)
sr1.SetOffset(SearchRequest.OFFSET_NONE)
sr1.SetCountType(SearchRequest.CountType.RECORD_COUNT_AND_RESULTS)
 
dim results as SearchResultSet = session.Search(sr1)
 
When I run this code I get error Invalid Query Syntax (librets.RetsReplyExceptionNative: Invalid Query Syntax.) and it flags the error on the dim results as SearchResultSet. I'm certain this is a very simple error and something obvious that I'm missing, which is why I post it here. I'm guessing most of you could just glance at this and get the error. I'm hoping anyway.
 
 Thomas Hawkins
.NET Developer/Graphic Designer

Dylan Thompson

unread,
Nov 21, 2011, 2:31:24 PM11/21/11
to Alex Hawkins, For discussion and help for and by the users of the libRETS C++ library
Thomas,

Try using (Status=|A) instead of (Status=Active)

The Status field probably uses lookups.  You can tell if a field uses lookups by examining the metadata, the Interpretation column will read "Lookup" for that field.  You are supposed to use =| instead of = when searching lookups, although in my experience it doesnt matter for most RETS server.  For some it will, so I always use =| whenever searching on a field that uses lookups.

Also use "A" instead of "Active" because Active is the decoded value while A is the coded value.  Someone correct me if I am wrong, but when searching on a lookup field, you have to specify the code instead of the decode.

-Dylan

_______________________________________________
libRETS-users mailing list
libRET...@crt.realtors.org
http://mail.crt.realtors.org/mailman/listinfo/librets-users


Alex Hawkins

unread,
Nov 21, 2011, 3:25:03 PM11/21/11
to Dylan Thompson, For and help for and by the users of the libRETS C++ library
Perfect, solved the problem succintly. As a nod to all the help I've gotten, once I have a complete solution worked up I will be posting the working code examples along with the explanations I've received in a sort of walkthrough for .NET developers who are in my shoes (totally green and in over their heads).
 
Again though, you guys saved my life, and this project!
 
 Thomas Hawkins
.NET Developer/Graphic Designer

M.Hassan Hojjati

unread,
Dec 26, 2019, 4:15:37 PM12/26/19
to LibRets Mirror
Hi Alex, I am facing the same issue as you did, can you please share your resolution with me? I appreciate


On Monday, November 21, 2011 at 3:25:03 PM UTC-5, Alex Hawkins wrote:
Perfect, solved the problem succintly. As a nod to all the help I've gotten, once I have a complete solution worked up I will be posting the working code examples along with the explanations I've received in a sort of walkthrough for .NET developers who are in my shoes (totally green and in over their heads).
 
Again though, you guys saved my life, and this project!
 
 Thomas Hawkins
.NET Developer/Graphic Designer

Reply all
Reply to author
Forward
0 new messages