web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Creation of Filter through Query Expression

(0) ShareShare
ReportReport
Posted on by

Hello Everyone,

 

I'm using a Query Expression to filter some data, and I can't figure out how to make them case insensitive.

 

To explain this better I'll give you the following example

I get a string with keywords like this "MySQL Oracle". Currently I'm verifying the string by Operation.Similar condition.

But suppose if the search string starts with smaller case and the actual entry is in upper case then the above doesn't work since it's case sensitive.

I'm trying to make them case insensitive, That way I'll find the words that are not specifically written with the upper/lower cases.

So basically I need to know how to get all the results that contain the upper or lower case from the given words.

Thank you in advance.

*This post is locked for comments

I have the same question (0)
  • Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi,

    You can used ConditionalOperator.Like. But you need to remember, you need to put % also because this is like:

      var query = new QueryExpression(Contact.EntityLogicalName)
                {
                    ColumnSet = new ColumnSet(true),
                    NoLock = true,
                };
    
                query.Criteria.AddCondition("fullname", ConditionOperator.Like, "%temmy%");


    Hope this help!

  • Community Member Profile Picture
    on at

    Hi Temmy,

    I have a dynamic listof field name which is all in different case and the search entity through which I am searching can be in any case.

    I'll explain with your example like I've many names in different case in fullname field and search name would be also in any case like "Temmy","temmy","TEmmy","temmY"etc. so for all search it should works.

  • Nithya Gopinath Profile Picture
    17,078 on at

    Hi Ankur,

    Refer the link below.

    microsoft.public.crm.developer.narkive.com/.../case-insensitive-queryexpression

    Hope this helps.

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    In that case, create another hidden field to store all uppercase or all lowercase equivalent of full name value (maintain the sync on create/update)

    For ex. Full name “John Doe” will be stored as “JOHN DOE” in hidden field. Hence Query expression filter can be built like below:

    query.Criteria.AddCondition("new_customfullname", ConditionOperator.Like, "%" + value.ToUpper() + "%");

  • David Jennaway Profile Picture
    14,065 on at

    If you are using a Condition in the QueryExpression, then the sort order of the organisation database will determine if the query is case-sensitive or not. You can specify the sort order when the organisation database is created, but you can't change the sort order after this

  • Community Member Profile Picture
    on at

    Bad idea. "temmyABCDE" also fits this filter

  • Community Member Profile Picture
    on at

    After the request, you need to filter, for example Equals (result_string, StringComparison.InvariantCultureIgnoreCase)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans