Using the Legacy API (because that was the first thing I got to work), I’m trying to query using the following code and am getting inconsistent results:
$SearchString=“a%”;
$Table=“Contact”;
$returnFields = array('Valid fields in Contact Table ’
);
$query = array(‘Lastname’ => $SearchString);
$contacts = $app->dsQuery($Table,15,1,$query,$returnFields);
That works as expected, and returns the first 15 rows with all last names beginning with “A”
HOWEVER, if I change the search string to ab% it only returns one row, correctly. One where the Lastname only has 3 letters, beginning with Ab. I expect it to show all Lastname lengths, and all instances beginning with Ab. There are MORE 3 letter last names beginning with Ab, but they don’t show. If I use aa% or Aa% I get nothing, though there are many last names starting with Aa.
If I use %aa% then it lists all names with aa in the middle, or %a shows last names ending with a, as expected. I need to make complex queries and I wonder if I’m barking up the wrong tree. dsQuery as I’m trying to use it seems inconsistent.
Is there a better method to make queries or am I just missing something here with dsQuery?