Copied to clipboard

Flag this post as spam?

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


  • Bert 128 posts 251 karma points
    Jul 07, 2011 @ 15:31
    Bert
    0

    Descendants by property value

    @node.Descendants("doctypealias").Where("Visible").Where("propertyAlias != \"\"")

    I am trying to get all the descandants of a node with a specific nodetype (works)

    only the visible ones (works)

    with a specific string property filled in with a random value. This last part seems to be the problem. I only get a partal result. The qery is executed correct for the first branch in my tree.

    node
    - differentdoctypealias 1
    -- doctypealias (prop filled in) -- doctypealias -- doctypealias (prop filled in) - differentdoctypealias 2
    -- doctypealias (prop filled in)
    -- doctypealias (prop filled in)

    I only get 2 results in stead of the 4 I expect. What terrible mistake am I making? :)

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Jul 07, 2011 @ 16:05
    Sebastiaan Janssen
    1

    Yeah, this is strange, I don't get any results if I add the last where.

    For now, a workaround can be:

    @foreach (item in node.Descendants("doctypealias").Where("Visible")) {
       if(item.propertyAlias != "") {
         //do whatever
       }
  • Bert 128 posts 251 karma points
    Jul 07, 2011 @ 16:16
    Bert
    0

    alright thanks for the confirmation.

     

    Need to take a random selecting of 'X' items so will need another work around :)

Please Sign in or register to post replies

Write your reply to:

Draft