Clarity

  • 1.  Previous Attribute Value on Team Subobject

    Posted 07-27-2017 11:10 AM

    Hi folks.

        I am attempting to create a Start Condition on an Idea based process that runs when an Idea's Allocation has changed.

     

        I cannot select Allocation as a Previous Value in the Start Condition Builder UI:

     

     

       Attempting to enter the expression using the expected syntax ( _oldValue ) does not evaluate or validate successfully.

     

        

     

      One probably can work around this by using Total Labor Effort on the Idea (in theory these should be in sync, yes?) but I'd like to take a shot at doing this right first. What I really need is Allocation Summary Data on Idea Object Data Providers, but until then I need a custom attribute I can copy data into upon Allocation change.

     

      Some threads lead me to believe the process above can't be done. I simply want to make sure before I give up and move on to a different approach.

     

      Am I doing something wrong? Can this be done? i'm on 14.3 FP9.



  • 2.  Re: Previous Attribute Value on Team Subobject

    Posted 07-27-2017 12:40 PM

    FYI - my assumption that Total Labor Effort will always equal Total Allocation is incorrect. As a business process we do not track time to Ideas, therefore it may look 'in sync' in the UI but I see older ideas that do have time tracked to it, and others that just don't match.

    SELECT
    I.ID
    , I.CODE
    , I.NAME
    , (I.LABOR_ETCSUM/3600) AS LABOR_ETC_SUM
    , (I.LABOR_ACTSUM/3600) AS LABOR_ACT_SUM
    , (I.LABOR_EACSUM/3600) AS LABOR_EAC_SUM
    , CONVERT(DECIMAL(10,2),((I.LABOR_ETCSUM/3600)+(I.LABOR_ACTSUM/3600))) AS LABOR_TOTAL_EFFORT
    , CONVERT(DECIMAL(10,2),T.LABOR_ALLOCATION_SUM) LABOR_ALLOCATION_SUM
    FROM
    INV_INVESTMENTS I
    JOIN (SELECT SUM(T.PRALLOCSUM/3600) LABOR_ALLOCATION_SUM
              , T.PRPROJECTID FROM PRTEAM T WHERE 1 = 1
              GROUP BY T.PRPROJECTID) T ON I.ID = T.PRPROJECTID
         WHERE ODF_OBJECT_CODE = 'idea'

     

    For Total Allocation - Summing PRALLOCSUM per investment on PRTEAM appears to be the proper spot to pick this up from.



  • 3.  Re: Previous Attribute Value on Team Subobject
    Best Answer

    Posted 07-27-2017 05:01 PM

    Decided to hang my onChange event on Total Labor Effort and update the Total Allocation attribute on the Idea via XOG. Normalized data will always out perform an ACA.

    <!--  Idea - Write Team Total Allocation to OSUWMC Total Allocation Attribute - RKE 7/27/2017 -->

    <gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
      xmlns:jxml="jelly:xml" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


      <!-- Get idea name, code and total allocation -->
      <gel:setDataSource dbId="niku"/>
      <sql:query escapeText="false" var="data">
                   <![CDATA[
                SELECT
                I.NAME inv_name
                , I.CODE inv_code
                , CONVERT(DECIMAL(10,2),T.LABOR_ALLOCATION_SUM) osuwmc_total_alloc
                FROM
                INV_INVESTMENTS I
                JOIN (SELECT SUM(T.PRALLOCSUM/3600) LABOR_ALLOCATION_SUM
                          , T.PRPROJECTID FROM PRTEAM T WHERE 1 = 1
                          GROUP BY T.PRPROJECTID) T ON I.ID = T.PRPROJECTID
                WHERE ODF_OBJECT_CODE = 'idea'
                AND I.ID = ${gel_objectInstanceId}]]>

          </sql:query>
              
      <!--  Get xog URL from application by fpena -->
      <core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="config"/>
      <core:set var="v_IsLocal">0</core:set>
      <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getId()}" var="WebServerid"/>
      <core:if test="${WebServerid == 'app'}">
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getAddress()}" var="AddressIp"/>
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getSslEntryUrl()}" var="EntryURL"/>
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getSslPort()}" var="Port"/>
        <core:if test="${EntryURL == 'http://localhost' }">
          <gel:log level="info" message="NULL ADDRESS IS LOCAL... "/>
          <core:set var="v_IsLocal">1</core:set>
          <core:set var="AddressIp">${EntryURL}</core:set>
        </core:if>
      </core:if>
      <core:if test="${WebServerid == 'nsa'}">
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getAddress()}" var="AddressIp"/>
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getEntryUrl()}" var="EntryURL"/>
        <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getPort()}" var="Port"/>
        <core:if test="${EntryURL == 'http://localhost' }">
          <gel:log level="info" message="NULL ADDRESS IS LOCAL... "/>
          <core:set var="v_IsLocal">1</core:set>
          <core:set var="AddressIp">${EntryURL}</core:set>
        </core:if>
      </core:if>
      <core:if test="${Port != null }">
        <core:set value="${EntryURL}" var="EntryURL"/>
      </core:if>
      <core:if test="${v_IsLocal == 0 }">
        <core:if test="${AddressIp != '' }">
          <core:set value="http://${AddressIp}" var="EntryURL"/>
        </core:if>
      </core:if>
      <core:set value="${config.getProperties().getDirectories().getInstallDir()}" var="NIKUHOME"/>
      <core:set value="${EntryURL}/niku/xog" var="xogURL"/>

      <!-- Get sessionId by XogUsername -->
            <gel:parameter var="xogUsername" default="xoguser"/>
            <core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId" />
            <core:invokeStatic var="userSessionCtrl" className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" />
            <core:set var="secId" value="${userSessionCtrl.init(xogUsername, secId)}"/>
            <core:set var="sessionID" value="${secId.getSessionId()}"/>
           
      <!-- Xog OSUWMC Total Allocation on Idea -->
      <soap:invoke endpoint="${xogURL}" var="runresult">
        <soap:message>
          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
            <soapenv:Header>
              <xog:Auth>
                <xog:SessionID>${sessionID}</xog:SessionID>
              </xog:Auth>
            </soapenv:Header>
            <soapenv:Body>
              <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_idea.xsd">
                <Header action="write" externalSource="NIKU" objectType="idea" version="8.0"/>
                <Ideas>
                  <Idea name="${data.rows.0.inv_name}" objectID="${data.rows.0.inv_code}" syncInvestmentAndBudgetDates="true">
                    <CustomInformation>
                      <ColumnValue name="osuwmc_total_alloc">${data.rows.0.osuwmc_total_alloc}</ColumnValue>
                    </CustomInformation>
                  </Idea>
                </Ideas>
              </NikuDataBus>
            </soapenv:Body>
          </soapenv:Envelope>
        </soap:message>
      </soap:invoke>

      <!-- Log out of xog -->
      <soap:invoke endpoint="${xogURL}" var="logoutresult">
        <soap:message>
          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
            <soapenv:Header>
              <xog:Auth>
                <xog:SessionID>${sessionID}</xog:SessionID>
              </xog:Auth>
            </soapenv:Header>
            <soapenv:Body>
              <xog:Logout/>
            </soapenv:Body>
          </soapenv:Envelope>
        </soap:message>
      </soap:invoke>
     
      <!-- comment out below log output once in production  -->
      <gel:log> ${xogURL}, ${sessionID}, ${gel_objectInstanceId}, ${data.rows.0.inv_name}, ${data.rows.0.inv_code}, ${data.rows.0.osuwmc_total_alloc}</gel:log>
    </gel:script>