I have a navigation script in which I want to filter out certain nodes based on their Id and I'm having trouble getting it to work. I'm using the 'Where' function and so far in the same script I've managed to exclude docTypes so it's just this tiny bit of code I'm having trouble with. So far I'm using this method, which isn't filtering the node:
What I'd try is looping the results and outputting the 'Id' as another check that a node with that id is actually in the collection.
Other than that, I'm not sure if there are many nuances with the string queries in that version: you might want to compare them as strings (/: yet flailing shot in the dark.)
Exclude nodes by Id
Hi everyone,
I have a navigation script in which I want to filter out certain nodes based on their Id and I'm having trouble getting it to work. I'm using the 'Where' function and so far in the same script I've managed to exclude docTypes so it's just this tiny bit of code I'm having trouble with. So far I'm using this method, which isn't filtering the node:
Please state the version of you Umbraco instance.
Hi Grant,
I'm using Umbraco 4.7.0. For the record, the method I use to exclude by docType (which might help) is: .Where("nodeTypeAlias != \"aDocType\"")
Hm, my only 4.1.x experience is 4.7.1 and even then it's scarce - so I'm just going to take a punt, at least for now...
I can't help but notice the camel casing of your 'nodeTypeAlias' query - as a sanity check, are you successful with a lowercase 'id'?
Ah, no worries! Yeah I tried with a lowercase 'Id' but to no avail unfortunately.
Okay,
What I'd try is looping the results and outputting the 'Id' as another check that a node with that id is actually in the collection.
Other than that, I'm not sure if there are many nuances with the string queries in that version: you might want to compare them as strings (/: yet flailing shot in the dark.)
is working on a reply...