+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Execution of 'System.Char:IsLetter(Char)' on the database server side currently not implemented.

Execution of 'System.Char:IsLetter(Char)' on the database server side currently not implemented.

3 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    01 Apr 2014
    Link to this post

    I am trying to get a collection of DynamicContent that begins with with a non-alphabetic value.

     This was my first attempt:

    query = query.Where(s => s.Status == ContentLifecycleStatus.Live && s.Visible == true
                            && !char.IsLetter(s.GetValue<string>(fieldName).First()));

    So then I stumbled upon an old post on the Telerik forums and tried something else, but that too doesn't work, plus I don't want to generate the entire list in memory before I filter it down.

     

    query = (IQueryable<DynamicContent>)query.ToList().Where(s => s.Status == ContentLifecycleStatus.Live && s.Visible == true
                            && !char.IsLetter(s.GetValue<string>(fieldName).First()));

    How else can I accomplish this?

  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Apr 2014 in reply to Stacey
    Link to this post

    Is it just 1-9 that are acceptable?

     FYI if no records are returned .First() will throw an exception, recommend FirstOrDefault

  3. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    02 Apr 2014 in reply to Steve
    Link to this post

    @Steve

    1-9 are the only values for that particular query that I care about and after looking at it more I am missing a .StartsWith() before that I need to add.  I already have an a-z filter working, but the requirement is to offer users a button to then get all company names that begin numerically.  

    I thought about looping through 1-9 and then doing then check on company name.  Hoping there is some LINQ magic I am missing that will get me there (assuming its implemented)

     

3 posts, 0 answered