Copied to clipboard

Flag this post as spam?

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


  • bh 291 posts 976 karma points
    Nov 29, 2018 @ 18:24
    bh
    0

    Node Children Query

    My query is ignoring my != "past community" filter, and I'm not sure how to fix it.

    var root = Model.Content.Site();
        var selection = root.Children.First(x => x.Name == "Multifamily").Children.Where(x => x.IsVisible()).Where(x => x.GetPropertyValue<Boolean>("communityDetailIsHidden") == false).Where(x => x.GetPropertyValue<String>("communityDetailStatus").ToString().ToLower() != "past community").DistinctBy(x => x.GetPropertyValue<string>("communityDetailState")).OrderBy(x => x.GetPropertyValue<string>("communityDetailState"));
    
  • Nicholas Westby 2005 posts 6843 karma points c-trib
    Nov 29, 2018 @ 19:48
    Nicholas Westby
    0

    Try inspecting the value with the debugger to see if it's actually returning "past community". If it's a drop down, it might be returning an integer prevalue that's associated with the text "past community" (or some other value you're not expecting).

  • bh 291 posts 976 karma points
    Nov 29, 2018 @ 20:01
    bh
    0

    Watched the value in the "watch" window and it's evaluating as a string. "past community" is the value shown for that parameter in the watch window.

  • Nicholas Westby 2005 posts 6843 karma points c-trib
    Nov 29, 2018 @ 23:33
    Nicholas Westby
    0

    I reformatted the code a bit to make it easier to read:

    var root = Model.Content.Site();
    var selection = root
        .Children
        .First(x => x.Name == "Multifamily")
        .Children.Where(x => x.IsVisible())
        .Where(x => x.GetPropertyValue<Boolean>("communityDetailIsHidden") == false)
        // This is the line of interest.
        .Where(x => x.GetPropertyValue<String>("communityDetailStatus").ToString().ToLower() != "past community")
        .DistinctBy(x => x.GetPropertyValue<string>("communityDetailState"))
        .OrderBy(x => x.GetPropertyValue<string>("communityDetailState"));
    

    Seems like that should work. How are you verifying that it does not work?

    One thing to keep an eye on is the "past community" value (e.g., to ensure there are no leading or trailing spaces or other non-obvious characters, such as line breaks).

  • 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