Copied to clipboard

Flag this post as spam?

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


  • pooja 15 posts 35 karma points
    Sep 21, 2011 @ 12:11
    pooja
    0

    want to group by a multiple column of list dynamically

    wanted do group by on multiple list column where  i can pass column name and order of which they can group by can any one help me. please let me know is it possible or not?

  • Richard 146 posts 168 karma points
    Sep 21, 2011 @ 16:10
    Richard
    0

    You need to use the xsl:sort to sort the data, you can use multiple sort statements to sort by more than one field. If I remember correctly you can not use a variable in the sort statement, you will need to do a xsl:choose/xsl:when to switch to the different sort statements based on some input.

    Richard

  • pooja 15 posts 35 karma points
    Sep 21, 2011 @ 18:19
    pooja
    0

    hi Richard,

    Thanks for reply.

    I have used a xsl:sort and also set the variable in xsl choose/xsl:when but while populating the records it is giving me error as variable must set as node-set so i used msxsl:node-set function.but after using this it will giving me error but not showing any result.  so i used  msxsl:node-set($test)*/.This is showing result . but I am populating data from 3 different list in single dataview. if i set variable like above in 1st list then 2nd and 3rd list is not populating any value. if i set variable like this in 2nd list 3rd list is not populating.  can you please reply this I do not understand what is */ stands for.

     

  • Richard 146 posts 168 karma points
    Sep 21, 2011 @ 18:44
    Richard
    0

    I would tackle this problem like this:

    1. Decide which sort order is to be used. set some variable
    2. Choose the sort order statement
    3. Present the items

    To start creating the XSLT do:

    <xsl:variable name="sortControl" select="string('a')"/>

    <xsl:choose>
    <xsl:when test="$sortControl = 'a'">
    <!-- Get all nodes below the current -->
    <xsl:apply-templates select="$selectedNodes" select="$currentPage/*[@isDoc]">
    <xsl:sort select="data[@alias='fieldOne']" order="ascending" />
    <xsl:sort select="data[@alias='fieldTwo']" order="ascending" />
    </xsl:apply-templates>
    </xsl:when>
    <xsl:when test="$sortControl = 'b'">
    <!-- Get all nodes below the current -->
    <xsl:apply-templates select="$selectedNodes" select="$currentPage/*[@isDoc]">
    <xsl:sort select="data[@alias='fieldOne']" order="descending" />
    <xsl:sort select="data[@alias='fieldTwo']" order="descending" />
    </xsl:apply-templates>
    </xsl:when>
    </xsl:choose>


    <xsl:template match="*">

    <p>One item found.</p>
    <p>XML of node:</p>
    <xsl:copy-of select="."/>
    <hr/>
    </xsl:template>
  • pooja 15 posts 35 karma points
    Sep 22, 2011 @ 07:31
    pooja
    0

    hi Richard,

    I would like to know what  /* does?

    like  i said  i am  getting data from 3 list  as a subview of one after the other.


      Table

    //settting a variable to assign to rows variable by checking user in which group.

     
        
       <xsl:template name="dvt_1">
      <xsl:variable name="dvt_StyleName">Table</xsl:variable>
      
      <xsl:variable name="test" >
      <xsl:choose>
      <xsl:when test="$useringroup='PO'">
      <xsl:copy-of select="/dsQueryResponse/Process/Rows/Row[@ActiveState='1' and string(substring-after(substring-after(substring-before(string(@ProcessOwner),'&lt;/A&gt;'),'ID='),'&gt;')) = $UserID  and  string(@ProcessState)!='New']"></xsl:copy-of>
      </xsl:when>
      <xsl:otherwise></xsl:otherwise>
      </xsl:choose>
      
      <!--<xsl:call-template name="filter"></xsl:call-template>-->
      </xsl:variable>

      
      
      
      
       
     // assigning that variable here if i do not use/* then it will not show any result.
     

     <xsl:variable name="Rows" select="/dsQueryResponse/Process/Rows/Row[@ActiveState='1' and string(substring-after(substring-after(substring-before(string(@ProcessOwner),'&lt;/A&gt;'),'ID='),'&gt;')) = $UserID  and  string(@ProcessState)!='New']"></xsl:variable><xsl:variable name="dvt_RowCount" select="count($Rows)" /><xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" /><xsl:choose>
       <xsl:when test="$dvt_IsEmpty">
        <xsl:call-template name="dvt_1.empty" />
       </xsl:when>
       <xsl:otherwise><table width="100%" border="0" cellspacing="0" cellpadding="0"   style="border-collapse:collapse" bordercolor="#d1e2fc">
       <tr valign="top">
        <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
         <th class="ms-vh" nowrap="nowrap"></th>
        </xsl:if>
        <th class="ms-vh" nowrap="" style="width:100px;border-right:1px solid white;padding-left:35px;">Test Name</th>    
        <th class="ms-vh" nowrap=""  style="display:none">Test Instructions</th>
        <th class="ms-vh" nowrap="" style="border-right:1px solid white;">Test Frequency</th>
        <th class="ms-vh" nowrap="" style="border-right:1px solid white;">Test Period</th>
       </tr>
       <xsl:call-template name="dvt_1.body">
        <xsl:with-param name="Rows" select="$Rows"/>
        <xsl:with-param name="FirstRow" select="1" />
        <xsl:with-param name="LastRow" select="$dvt_RowCount" />
       </xsl:call-template>
      </table></xsl:otherwise>
      </xsl:choose>
      
      
     </xsl:template>

       
        
       
       

                                                                 
     Test NameTest InstructionsTest FrequencyTest Period


      
     

     after getting this by using a subview i am gettiing data from my second list but my second list not showing any data. and does not give any error  so i am not able to understand the problem.

    If i directlly assign my query to rows variable then It will not have any problem.

     

     

     

  • Richard 146 posts 168 karma points
    Sep 22, 2011 @ 11:45
    Richard
    0

    Pooja,

    The ./* is to select all nodes, of any name below the current page. Please excuse my poor copy & paste, as select="$selectedNodes" should not be in the apply-templates tag.

    I would suggest simplifying your select statement if you are not getting any results, to work out what is causing the problem.

  • pooja 15 posts 35 karma points
    Sep 22, 2011 @ 12:07
    pooja
    0

    hi Richard,

    thanks but i am not getting what you are saying?

    i  am listing data  from 3 list in single view i have 3 select Queries I want that 3 select Query as dynamic so i set them in variable and applying that variable to my select clause  by setting a node-set my first list is showing data but second third list not showing any thing.

     

  • pooja 15 posts 35 karma points
    Sep 22, 2011 @ 12:57
    pooja
    0

    hi Richard,

    i would like to ask you  that  after using /* are we able to itrate to any other node

  • 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