Trying to filtering various types of nodes depending on querystring parameters. The nodes can be filtered by the following
choosing a service filters the client and project nodes
choosing a client filters the project nodes
The !service.IsEmpty() check works correctly, returning projects which contain the related service, and clients which the filtered projects contain.
An issue occurs when selecting a client. When a service and a client is selected, it should only filter projects. Yet it is also filtering clients and returning only the selected client ... not want is needed. I can't work out what the issue might be.
The "offending code" is below.
Thanks in advance for any assistance, it is greatly appreciated.
@{ var service = Request["service"].IsEmpty() ? "" : Request["service"]; var client = Request["client"].IsEmpty() ? "" : Request["client"]; var clients = CurrentModel.Sibling("ClientSection").Descendants("Client").Items.Where(x => x.Visible); var services = CurrentModel.Sibling("ServiceSection").Descendants("Service").Items.Where(x => x.Visible); var projects = CurrentModel.Descendants("Project").Items.Where(x => x.Visible); if (!service.IsEmpty()) { projects = projects.Where(p => p.GetPropertyValue("Service").Contains(service)); clients = clients.Where(c => projects.Any(p => p.GetPropertyValue("Client").Contains(c.Id.ToString()))); } if (!client.IsEmpty()) { projects = projects.Where(p => p.GetPropertyValue("Client").Contains(client)); } }
Filtering nodes via Lambda Expressions assistance
Trying to filtering various types of nodes depending on querystring parameters. The nodes can be filtered by the following
The !service.IsEmpty() check works correctly, returning projects which contain the related service, and clients which the filtered projects contain.
An issue occurs when selecting a client. When a service and a client is selected, it should only filter projects. Yet it is also filtering clients and returning only the selected client ... not want is needed. I can't work out what the issue might be.
The "offending code" is below.
Thanks in advance for any assistance, it is greatly appreciated.
is working on a reply...