Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Sep 16, 2012 @ 10:02
    Anthony Candaele
    0

    problem with where clause

    Hi,

    I'm using a Razor where statement to get a list of childnodes:

    subcategoryItems = @Model.AncestorOrSelf("SolutionArea").Children.Where("solutionSubcategories == \"" + subcategory + "\"");

    However, when I add a AND (&&) condition to the WHERE clause I get an error:

    subcategoryItems = @Model.AncestorOrSelf("SolutionArea").Children.Where("solutionCategory == \"" + category + "\"" && "solutionSubcategories == \"" + subcategory + "\"");

    Is there a syntax error in this statement??

    thanks for your help,

    Anthony

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Sep 16, 2012 @ 11:27
    Jan Skovgaard
    1

    Hi Anthony

    What does the error message say?

    /Jan

  • Anthony Candaele 1197 posts 2049 karma points
    Sep 16, 2012 @ 13:30
    Anthony Candaele
    0

    Hi Jan,

    Can't say, the debugger won't step in the process. Maybe it's a syntax error.

    greetings,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Sep 16, 2012 @ 14:06
    Anthony Candaele
    1

    found the issue, this where clause works:

    subcategoryItems = Model.AncestorOrSelf("SolutionArea").Children

                            .Where("solutionSubcategories == \"" + subcategory + "\" && solutionCategory==\""+ category + "\""); 

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies