Search code examples
codefluent

How filter in a grid view like '% value %'?


how I can use a method search for generate a query like this SEARCH(name) select * from person where name like '% name %' and how I set this method to filter a gridview? I only see the option for startwith and endwith


Solution

  • CFQL supports the concatenation operation, so you can use the following CFQL method:

    SEARCH(Name) WHERE Name LIKE '%' + @Name + '%'
    

    If you edit your model directly in XML, you have to escape the character %:

    <cf:method name="SearchSample" body="SEARCH(Name) WHERE Name LIKE '%%' + @Name + '%%'" />
    

    Formal grammar of CodeFluent Query Language (CFQL)