none
How do I filter for a specific string variable contining a desired text. RRS feed

  • Question

  • If I have a stored procedure that returns a result set such as the following:

    GROUPID    WORKFLOWTYPE    SERVICE
    -----------     ---------------------    -----------

    1                 DRAFT                    FRI
    2                 FNOL_INTERNAL    FRI
    3                 WORKFLO              FRI

    I want to filter for a single first string value for WORKFLOWTYPE that contains "FNOL"

    I have something like this, so far, but it doesn't work:

    using (var db = new CaremcDB(Database.Conn))
    {
       var workflowtype = db.GetWorkflowTypes(employerId, "EMPR").FirstOrDefault().WorkflowType.Where(t => t.ToString().ToUpper().Contains("FNOL"));
       return workflowtype;
    }


    I am expecting "FNOL_INTERNAL" for the result.

     

     



    • Edited by Bill2010 Wednesday, December 21, 2011 7:19 PM
    Wednesday, December 21, 2011 7:16 PM

Answers

  • The query is not written correctly.  Try:

    using (var db = new CaremcDB(Database.Conn))
    {
       var workflowtype = db.GetWorkflowTypes(employerId, "EMPR").FirstOrDefault(t => t.WorkflowType.Contains("FNOL"));
       return workflowtype;
    }
    
    



    Reed Copsey, Jr. - http://reedcopsey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by Bill2010 Wednesday, December 21, 2011 10:29 PM
    Wednesday, December 21, 2011 7:44 PM