Copied to clipboard

Flag this post as spam?

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


  • mmmoustache 50 posts 79 karma points
    Mar 27, 2012 @ 12:36
    mmmoustache
    0

    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:

    .Where("Id != 1000")

  • Grant Thomas 291 posts 324 karma points
    Mar 27, 2012 @ 12:39
    Grant Thomas
    0

    Please state the version of you Umbraco instance.

  • mmmoustache 50 posts 79 karma points
    Mar 27, 2012 @ 12:48
    mmmoustache
    0

    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\"")

  • Grant Thomas 291 posts 324 karma points
    Mar 27, 2012 @ 12:51
    Grant Thomas
    0

    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'?

  • mmmoustache 50 posts 79 karma points
    Mar 27, 2012 @ 13:11
    mmmoustache
    0

    Ah, no worries! Yeah I tried with a lowercase 'Id' but to no avail unfortunately.

  • Grant Thomas 291 posts 324 karma points
    Mar 27, 2012 @ 14:03
    Grant Thomas
    0

    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.)

Please Sign in or register to post replies

Write your reply to:

Draft