KB Article T385990
Visible to All Users

How to make the Grid's filter case- and accent-insensitive in Server Mode

In Server Mode, the Grid utilizes filtering capabilities provided by ORM used as a data access layer. ORM translates an object query into an SQL query and loads filtered data from the database. Therefore, it depends on the database server settings whether or not filtering operations are case- or accent-insensitive.

Most of database servers provide options to configure the case and accent sensitivity globally or for specific tables. We suggest using this feature as the most convenient way to enable the case- and accent-insensitivity for filtering operations. Refer to the documentation of your SQL server for additional details. For your convenience, we have found corresponding articles in the documentation for several mainstream SQL servers:

MS SQL Server
Collation and Unicode Support
Selecting a SQL Server Collation

Oracle
Linguistic Sorting and Matching

MySQL
Character Sets and Collations in General
Server Character Set and Collation

PS: There is an undocumented flag that forces Server Mode collections to ignore character casing: DevExpress.Data.Helpers.ServerModeCore.DefaultForceCaseInsensitiveForAnySource. If you enable this option in the application entry point (the Program.cs file in WinForms or Global.asax file in Web applications), Server Mode collections will include the ToLower function in the filter expression. Note that if you are using indexes to improve performance, SQL server can ignore them in this mode. Use this approach only when there is no way to configure the database server.

Show previous comments (2)

    Hi Uriah,

    I have been using MSSQL and everything was working fine technically but due to cost factor I have been exploring PostgreSQL which seems to no cost solution for me and performance wise much better as well. But I am running in to few difficulties, one of which is the case-sensitivity.

    In my web XAF app, when the user searches any text then it has to be case sensitive. I looked at this post of yours and found that there is a global setting for making the search case in-sensitive. I have applied this static property and set it to true in the Global.asax file but that doesn't seems to be working either. Could you please guide me on how to get rid of this case sensitivity for Postgres

    C#
    protected void Application_Start(Object sender, EventArgs e) { DevExpress.Data.Helpers.ServerModeCore.DefaultForceCaseInsensitiveForAnySource = true; }
    DevExpress Support Team 6 years ago

      Hi Farooq,

      I've created a separate ticket on your behalf (T724378: Does DefaultForceCaseInsensitiveForAnySource option work with PostgreSQL and XAF?). It has been placed in our processing queue and will be answered shortly.

      J J
      Joche Ojeda - DevExpress MVP 5 years ago

        To avoid problems with searches, I recreated XAF search controller, the idea is to convert the values to compare to uppercase as well as the value from the column by using the function to upper on the server side.Here you can find an article about my experiences with the search controller in XAF https://www.jocheojeda.com/2018/12/01/xaf-filtercontroller-case-insensitive-search/ feel free to take and/or modify the code as you needed

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.