Copied to clipboard

Flag this post as spam?

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


  • Heather 13 posts 125 karma points
    Jun 04, 2020 @ 18:33
    Heather
    0

    Query Help

    So far I have the following:

    var otherTypes = Model.AncestorOrSelf<InspireTypes>().Children.Where(x => x.IsVisible());
    

    I have a variable catName that contains the current category. I want to modify the query above to search InspireCategory.CategoryName for the catName. I want to only return the records that match the catName.

    I have been at this awhile with many different ways of trying to get this data without any luck. Any help would be appreciated. Thanks so much in advance.

    Results view of the current simple query

  • Victor 25 posts 152 karma points
    Jun 04, 2020 @ 18:55
    Victor
    100
    Model.AncestorOrSelf<InspireTypes>().Children.Where(x => x.IsVisible() && ((InspireCategory)x.InspireCategory).CategoryName==catName);
    

    If I got it right..

  • Heather 13 posts 125 karma points
    Jun 04, 2020 @ 20:18
    Heather
    0

    I had to modify slightly, thank you for getting me on track

     var otherTypes = Model.AncestorOrSelf<InspireTypes>()
        .Children
        .Where(x => x.IsVisible())
        .Select(x => x as InspireType)
        .Where(x=> ((InspireCategory)x.InspireCategory).CategoryName == catName)
        .ToList();
    
Please Sign in or register to post replies

Write your reply to:

Draft