Length of String in WHERE Clause

I want to retrieve records containing strings of more than a certain length in a certain column. SQL has a LEN function, but the function apparently is not supported by Backendless in the REST console. Is there a way to achieve the search / WHERE that I want?

Hello @Howard_Jacobson

Unfortunately for now there is no way to get the field’s length. I have created an internal ticket to add the function, it will be released in 2-3 weeks.

Hi Howard,

Here’s a solution for you:

  1. Create a generated column in the same table with the formula shown in the screenshot below. In that example, my generated column name is nameLength and it calculates the length of the value in the column name:

  2. Now my data table looks as shown below:
    Data Browser - ConsoleDemo - Backendless 2023-05-15 11-27-55

  3. The nameLength column can be used in where clause:

Hope this helps.

Regards,
Mark

Hi @Howard_Jacobson

We have added support for the LENGTH function in where clause and properties. The correct syntax should look like this:

where=LENGTH(<source column>) > x

property=LENGTH(<source column>) as NewFunction

Regards,
Marina