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).
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).
Node Children Query
My query is ignoring my
!= "past community"
filter, and I'm not sure how to fix it.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).
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.
I reformatted the code a bit to make it easier to read:
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).
is working on a reply...