Copied to clipboard

Flag this post as spam?

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


  • Jason Prothero 416 posts 1226 karma points c-trib
    May 14, 2011 @ 00:21
    Jason Prothero
    0

    Error when trying to find documents without a certain nodeTypeAlias

    When I try this:

     

    @Model.NodeById(parentNode).DescendantsOrSelf().Where("nodeTypeAlias != \"Archive\"")

     

    I'm getting an error:

    "Cannot invoke a non-delegate type"

     

    Using 4.7.0

     

    Should that work?

  • Jason Prothero 416 posts 1226 karma points c-trib
    May 14, 2011 @ 00:23
    Jason Prothero
    0

    This works fine:

    @Model.NodeById(parentNode).DescendantsOrSelf().Where("nodeTypeAlias.Contains(\"Story\")")

  • Robert Foster 440 posts 1684 karma points MVP admin c-trib
    May 14, 2011 @ 16:18
    Robert Foster
    0

    Hi Jason,

    Give this a try:

    @Model.DescendantsOrSelf().Where("!nodeTypeAlias.Equals(\"Archive\")")

  • Jason Prothero 416 posts 1226 karma points c-trib
    May 15, 2011 @ 00:25
    Jason Prothero
    0

    Still getting that error.  It's like when I use not (!) then it throws the error.

     

     

  • Robert Foster 440 posts 1684 karma points MVP admin c-trib
    May 15, 2011 @ 05:39
    Robert Foster
    0

    Hm.  Try posting your script - I tried the above expression and didn't get any error regardless of what I was comparing the nodeTypeAlias to...

    Also, is that the full error you are getting?

  • Laurent Lequenne 120 posts 245 karma points
    May 16, 2011 @ 14:18
    Laurent Lequenne
    0

    Model.DescendantsOrSelf("Archive") ... Looks fine to me ... But it's not :-)) Sorry

  • Laurent Lequenne 120 posts 245 karma points
    May 16, 2011 @ 14:20
    Laurent Lequenne
    0

    Use not insteed of ! =>

    @Model.DescendantsOrSelf().Where("not(nodeTypeAlias.Equals(\"Archive\"))")

  • Jason Prothero 416 posts 1226 karma points c-trib
    May 16, 2011 @ 18:35
    Jason Prothero
    0

    OK, I did a smaller test and both of these methods work.  Thanks guys! 

     

    Unfortunately, that means the problem is elsewhere...

  • Tom 713 posts 952 karma points
    Jul 14, 2011 @ 09:51
    Tom
    0

    Model.Descendants.Where("NodeTypeAlias == \"externalCollection\" || NodeTypeAlias  == \"individualCollection\"");

     

    any reason why that doesn't work??

  • Laurent Lequenne 120 posts 245 karma points
    Jul 14, 2011 @ 09:59
    Laurent Lequenne
    0

    nodeTypeAlias :-)

  • Tom 713 posts 952 karma points
    Jul 14, 2011 @ 10:10
    Tom
    0

    nope still doesn't work

     var allCollectionItems = Model.Descendants.Where("nodeTypeAlias.Equals(\"externalCollection\") || nodeTypeAlias.Equals(\"individualCollection\")");

    if(allCollectionItems != null)
        
          <ul>
            @foreach (var item in allCollectionItems)
            {
            <li><href="@item.Url"@cssClassForItem(item)>@item.Name</a></li>
            }
          </ul>
        }

  • Tom 713 posts 952 karma points
    Jul 14, 2011 @ 10:12
    Tom
    0

    var allCollectionItems = Model.Descendants.Where("nodeTypeAlias.Equals(\"externalCollection\") || nodeTypeAlias.Equals(\"individualCollection\")");

     

     

     

    if(allCollectionItems != null)
        
          <ul>
            @foreach (var item in allCollectionItems)
            {
            <li><href="@item.Url"@cssClassForItem(item)>@item.Name</a></li>
            }
          </ul>
        }

     

     


     


  • Thomas Boyd 10 posts 30 karma points
    Nov 01, 2011 @ 11:57
    Thomas Boyd
    0

    The Where function accepts operators such as equal, contains ect... does anyone have a list of these or know where I could find a list? Would be very handy.

  • 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