Problem with "like" in filters

When using “like” in a filter I am getting odd results when the pattern starts with “%” and the match starts with the first character in the string. For example, if:

  1. My filter looks like “filter=region like %BayArea%”
  2. The database contains one record whose “region” field contains “BayArea Denver”

the record is not returned in a “get” request. However, if my filter looks like “filter=region like BayArea%” the record is returned as expected.

This seems like it goes against the SQL definition for % where % is supposed to match zero, one, or more characters. Here it seems that % matches one or more, but not zero.

Hi @jsolbrig

https://wiki.dreamfactory.com/DreamFactory/Features/Database/Records#Filter_Strings based on the docs, both should be supported.

CloudApp

I ran a couple of examples and see that it is working correctly.

Dreamfactory Instance:
CloudApp

CloudApp

Example of returning zero records:
CloudApp

Insomnia:
CloudApp

CloudApp

The designation of %ANY_STRING% in Dreamfactory is meant to work for contains, not specifically zero, one or more, but just the recognition that the string is, in fact, present as a match.

I don’t suppose you have a snippet of schema you could send over for us build out in our test database and to do some other testing against? If not, we can try to recreate something to do further testing.

For what it is worth, we are using for our testing:
CloudApp