Try our conversational search powered by Generative AI!

CompareCondition.StartsWith

Vote:
 

I'm trying to return pages with a string property starting with a provided letter. if I provide the letter 'A' it returns correct the pages with property A that starts with letter 'A' but only if the second letter isn't also the letter 'A'. Will match on 'Andorra' but not on 'Aalborg'. Any suggestions?

string input = "Aa";
var criterias = new PropertyCriteriaCollection();
var queryCriteria = new PropertyCriteria
{
Condition = CompareCondition.StartsWith,
                Name = "LastName",
                Value = input,
                Type = PropertyDataType.String,
                Required = true
        };

criterias.Add(queryCriteria);
var pages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias, CurrentPage.LanguageBranch);

Stig

#55210
Nov 22, 2011 18:11
Vote:
 

Maybe use Truffler? :). I know there´s also LINQ to PageData that might be better to use for this: http://labs.episerver.com/en/Blogs/Johano/Dates/2010/6/Querying-EPiServer-PageData-using-LINQ/.

Hope this helps.

Frederik

#55213
Nov 22, 2011 19:44
Vote:
 

Because of database collation, perhaps? ("Aa may be treated as "Å")

#55726
Dec 14, 2011 12:31
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.