Clarity

 View Only
  • 1.  Updating Team data using custom process

    Posted Jul 19, 2016 07:58 PM


    Attempting to update start/end dates on the TEAM tab, as well as the Staff OBS using a custom process.  First attempt destroyed the Allocation information, due to this limitation: http://www.ca.com/us/support/ca-support-online/product-content/knowledgebase-articles/tec1055215.aspx

     

    So now XOG'ing out the whole Project, including Team and Allocations, and have successfully used XSL stylesheet to update the Start and End Dates.  However, I can't get the stylesheet to update the StaffOBSUnit:

        <x:parse var="xsl">

          <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

            <xsl:output cdata-section-elements="nsql" method="xml"/>

            <xsl:preserve-space elements="nsql"/>

            <xsl:template match="Resource/@resourceID[.='${v_rows.unique_name}']">

              <xsl:attribute name="availTo">

                <xsl:value-of select="'${v_rows.prfinish}'"/>

              </xsl:attribute>

              <xsl:attribute name="availFrom">

                <xsl:value-of select="'${v_rows.prstart}'"/>

              </xsl:attribute>

              <xsl:attribute name="staffOBSUnit">

                <xsl:value-of select="'${v_rows.obs_name}'"/>

              </xsl:attribute>

              <xsl:attribute name="resourceID">

                <xsl:value-of select="'${v_rows.unique_name}'"/>

              </xsl:attribute>

            </xsl:template>

            <xsl:template match="XOGOutput"/>

            <xsl:template match="node()|@*">

              <xsl:copy>

                <xsl:apply-templates select="@*|node()"/>

              </xsl:copy>

            </xsl:template>

          </xsl:stylesheet>

        </x:parse>

        <x:parse var="xml">

          <gel:include select="$v_project_output"/>

        </x:parse>

        <gel:parse var="v_project_output1">

          <x:transform xml="${xml}" xslt="${xsl}"/>

        </gel:parse>

     

    Has anyone done anything similar, or can spot why the staffOBSUnit doesn't get updated in  the above XSL, even though the availTo and availFrom does?



  • 2.  Re: Updating Team data using custom process

    Posted Jul 20, 2016 12:29 AM


  • 3.  Re: Updating Team data using custom process

    Posted Jul 20, 2016 12:36 AM

    Thanks for the link, but that case the user was attempting to do a direct database update.  I will provide a comment to this one though.

     

    In my case, I have xogged out the Project/Team/Allocations so I have all the required data, and updating via XSL the required attributes (eg availFrom, availTo) .  This is then xogged back in, so I have all the data, in particular Allocations.  All working with the exception of StaffOBSUnit.



  • 4.  Re: Updating Team data using custom process
    Best Answer

    Posted Jul 21, 2016 03:47 AM

    Took this challenge down a XML tool, and believe this is what is required:

        <x:parse var="xsl">
          <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
            <xsl:output cdata-section-elements="nsql" method="xml"/>
            <xsl:preserve-space elements="nsql"/>
    <xsl:template match="Projects">
      <xsl:element name="Projects">

        <xsl:for-each select = "Project">
          <xsl:element name="Project">
         <xsl:attribute name="projectID">  <xsl:value-of select = "@projectID[.]"/>  </xsl:attribute>
       <xsl:attribute name="name"> <xsl:value-of select = "@name[.]"/> </xsl:attribute>

         <xsl:element name="Resources">
         <xsl:for-each select = "Resources/Resource">

        <xsl:if test="@resourceID[.='${v_rows.unique_name}']">
         <xsl:element name="Resource">
           <xsl:attribute name="resourceID"> <xsl:value-of select = "@resourceID[.]"/> </xsl:attribute>
                 <xsl:attribute name="staffOBSUnit">'${v_rows.obs_name}'</xsl:attribute>
                 <xsl:attribute name="availFrom">'${v_rows.prstart}'</xsl:attribute>
                 <xsl:attribute name="availTo">'${v_rows.prfinish}'</xsl:attribute>

         <xsl:element name="AllocCurve">
          <xsl:for-each select = "AllocCurve/Segment">
           <xsl:element name="Segment">
            <xsl:attribute name="finish"><xsl:value-of select = "@finish[.]"/></xsl:attribute>
            <xsl:attribute name="start"><xsl:value-of select = "@start[.]"/></xsl:attribute>
            <xsl:attribute name="sum"><xsl:value-of select = "@sum[.]"/></xsl:attribute>
           </xsl:element>
          </xsl:for-each>
         </xsl:element>

         <xsl:element name="HardAllocCurve">
          <xsl:for-each select = "HardAllocCurve/segment">
           <xsl:element name="segment">
            <xsl:attribute name="finish"><xsl:value-of select = "@finish[.]"/></xsl:attribute>
            <xsl:attribute name="rate"><xsl:value-of select = "@rate[.]"/></xsl:attribute>
            <xsl:attribute name="start"><xsl:value-of select = "@start[.]"/></xsl:attribute>
           </xsl:element>
          </xsl:for-each>
         </xsl:element>

         </xsl:element>
        </xsl:if>

         </xsl:for-each>

       </xsl:element>

      </xsl:element>

        </xsl:for-each>

       </xsl:element>

    </xsl:template> 

            <xsl:template match="XOGOutput"/>
            <xsl:template match="node()|@*">
              <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
              </xsl:copy>
            </xsl:template>
          </xsl:stylesheet>
        </x:parse>
        <x:parse var="xml">
          <gel:include select="$v_project_output"/>
        </x:parse>
        <gel:parse var="v_project_output1">
          <x:transform xml="${xml}" xslt="${xsl}"/>
        </gel:parse>

     

    It looks extra long, but the output is basically

    Project Code and Project Name

        Resource ID, Start, Finish, OBS

            Resource Allocations

     

    In my case I only want to update particular Team members, so if only outputs the required Team member.

     

    I couldn't work out why my previous version didn't work, but basically any attribute after the ResourceID (which I used for the search key) was not able to be updated.  In my case this included the staffOBSUnit, so had to resort to version 2.

     

    The main outtake of this, if you are updating the Team data, you NEED to bring in all the Allocation data, otherwise, it will disappear if you don't XOG it back in again.



  • 5.  Re: Updating Team data using custom process

     
    Posted Jul 21, 2016 11:51 AM

    Thanks for sharing the solution Roland!