Copied to clipboard

Flag this post as spam?

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


  • Justin Grimm 56 posts 138 karma points
    Oct 15, 2012 @ 17:24
    Justin Grimm
    0

    Retrieve Items by Datatype Values

    I have a checkboxlist custom datatype.  The checkboxlist values are set in the content.  I'm trying to iterate over the values in the datatype and pull back all nodes tagged with the selected properties.  I can't seem to pull back just the selected nodes, without pulling back everything.

    Datatype Options:

    Current Output (notice the same article being brought back under each Type):


    <xsl:for-each select="$typeList//preValue">    
       
    <h3><xsl:value-of select="current()"/></h3>

       
    <xsl:call-template name="entriesByType">
           
    <xsl:with-param name="type" select="." />
       
    </xsl:call-template>
    </xsl:for-each>

     

     

    <xsl:for-each select="$povTopNode/self::*[@isDoc][contains(concat(povType, ','), concat(type, ','))]">
       
    <xsl:value-of select="@nodeName" /><br />
    </xsl:for-each>

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 15, 2012 @ 19:39
    Dennis Aaen
    0

    Hi Justin,

    I will try to help you as much as I can.

    First, I created a property in my document type named checkbox.
    The data type I use is the ultimate picker.

    On the ultimate picker datatype I set type to checkbox list, as shown below in the picture.


    Here I choose also the parent node to a pull from, and what documtype individual choice options should have, and whether to take grandchildren.

    My XSLT to this, look likes this, perhaps this can be written in more appropriate way.

    <xsl:template match="/">

      <xsl:variable name="relItems" select="$currentPage/checkBox" />
      <xsl:variable name="nodeIds" select="umbraco.library:Split($relItems, ',')" />  

       <xsl:for-each select="$nodeIds/value">
         <xsl:call-template name="select_products">   
           <xsl:with-param name="product_Id" select="."/>
         </xsl:call-template>
      </xsl:for-each>       
     
    </xsl:template>
     
    <xsl:template name="select_products">
          <xsl:param name="product_Id"/>
      <xsl:variable name="productNode" select="umbraco.library:GetXmlNodeById($product_Id)"/>
         
          <xsl:for-each select="$productNode">
              ID: <xsl:value-of select="$productNode/@id"/>
          </xsl:for-each>
      </xsl:template>    
       
    </xsl:stylesheet>

    But I hope this small example can help you to solve your question.

    /Dennis



  • Justin Grimm 56 posts 138 karma points
    Oct 15, 2012 @ 19:56
    Justin Grimm
    0

    Thanks for the help on this one, Dennis. Unfortunately, I can't switch the datatype to an ultimate picker as I have content already in the for the datatype which would be lost. I've used them in the past and have been able to parse a list like this in the past using that approach. But for this one, I'm trying to avoid having the SubFolder with different types. That was my reasoning for using a generic checkbox list.  

    Still, I'd think there has to be a way to accomplish this.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 15, 2012 @ 20:46
    Dennis Aaen
    0

    Hi Justin,

    The way I've worked with my solution is to create new data types, which just has the same setup as the ultimate picker. As you mention in your post.

    So I hope you can use my suggestion for your solution. If you create a new data type, which is a copy of the ultimate picker.

    Since it is not possible to copy data types, you have to check the ultimate pickers settings and make the same on your new data types.

    Hope this can help you further.

    /Dennis

  • Justin Grimm 56 posts 138 karma points
    Oct 16, 2012 @ 17:50
    Justin Grimm
    0

    Figured this one out. I was pretty close originally.  

    Updated Code to:

    <xsl:template name="entriesByType"> <xsl:param name="type" /> <xsl:for-each select="$povTopNode/self::*[@isDoc][contains(povType, $type)]"> <a href="{umbraco.library:NiceUrl(./@id)}"><xsl:value-of select="@nodeName" /></a><br /> </xsl:for-each> </xsl:template>
  • urvish 9 posts 29 karma points
    Oct 25, 2012 @ 13:22
    urvish
    0

    Can we add new property in  Ultimate picker to show GradChild ID..??

    Suppose I have 5 child page.. If i want to show Id at shown in second figure text box of that grandchild pages with checkbox list in content then what to do??

    I anyone have idea about that than please tel me..

    Thanks in advance...

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 25, 2012 @ 13:51
    Dennis Aaen
    0

    Hi urvish,

    This example picture will list all grandchildren of node number 1109, but it only shows the grandchildren of the of documenttype SubPage.

    Then in the field you need to add the document type or document types, which must represent the checkbox values.

    I don´t know if it´s posible to add the id of an element.


    I hope this make sense, and it will help you further. If not feel free to ask again. I´am sure that other members on this forum also will try to help you.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft