To perform a case insensitive comparison you may use the function : CompareCaseInsensitive.
Example:
/sitecore/content//*[CompareCaseInsensitive(@@myfield,'MyValue')]
If you need to compare the field 'name' case insensitively you may use 'key' in place of 'name'.
Example:
/sitecore/content//*[@@key,'myvalue')]
Important: the search value has to be lower case!
All the XPath query function are available in Sitecore.Data.Query.Functions
Hey, I have tried CompareCaseInsensitive function in sitecore query, it does not work.
ReplyDelete/sitecore/content/Data/Doctors//*[CompareCaseInsensitive(@@FirstName,'walid')].
here firstname is field name.
Hello,
ReplyDeleteIt is simply because you have use a @@ for a custom field so you query should be:
/sitecore/content/Data/Doctors//*[CompareCaseInsensitive(@FirstName,'walid')
The @@ is only for the system fields like the name, the key, ...
Regards,