AnsweredAssumed Answered

Error while swapping data between 2 project attributes using Gel script

Question asked by cappmfan on Feb 8, 2016
Latest reply on Feb 11, 2016 by gcubed

Hi Experts,

 

Aim: To build a Gel script to swap data between 2 project attributes for all active projects using soap and xog...

 

 

 

The steps we have are as follows.

1. Xog out the project in Gel script.

2. Retrieve the values of the attributes (Manager and a Custom 'manager' attribute) from the xogged out xml (in memory)

3. After swapping the values, set the attribute values in the xml.

4. Xog in the modified xml back to application to update the project with swapped values.

 

Provided below is the basic structure of my Gel script with the error i am facing an error as enlarged and highlighted in Red below.

My problem here is while trying to set the value the managerresourceid attribute in the xogged out xml using gel:set.

 

 

 

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

   
   <!-- Log into XOG and get a session ID -  Works fine -->
       
   <!-- Using Soap to xog out project to variable xogresponse -->

   <soap:invoke endpoint="${xogURL}" var="xogresponse">
    <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_read.xsd">
   <Header version="6.0.11" action="read" objectType="project" externalSource="NIKU">
    
  <args name="order_by_1" value="name"/>
  <args name="order_by_2" value="projectID"/>
  <args name="include_tasks" value="false"/>
  <args name="include_dependencies" value="false"/>
  <args name="include_subprojects" value="false"/>
  <args name="include_resources" value="false"/>
  <args name="include_baselines" value="false"/>
  <args name="include_allocations" value="false"/>
  <args name="include_estimates" value="false"/>
  <args name="include_actuals" value="false"/>
  <args name="include_custom" value="true"/>
  <args name="include_burdening" value="false"/>
   </Header>
   
   <Query>


  <Filter name="projectID" criteria="EQUALS">009460</Filter>
   
   </Query>
  </NikuDataBus>
  </soapenv:Body>
  </soapenv:Envelope>
    </soap:message>
  </soap:invoke>
   


  
    <!--Retrieve value from xml where managerResourceID is an attribute of the Project element-->  
  <gel:set var="mgr" select="$xogresponse//@managerResourceID" asString="true" /> 

  <gel:out>${mgr}</gel:out>  Result here on running the script is managerResourceID="manager12". Expected result was "manager12"; without the attribute name.

  <gel:out>
   <gel:expr  select="$mgr"/>          Result here on running the script is "manager12" as expected, but how to use this to set an attribute in the project xml in memory (xogresponse variable)
  </gel:out>

   
  <!-- Trying to set value of managerResourceID  -->

  <gel:set value="${mgr}" select="$xogresponse//@managerResourceID"/>  

Result here on running the script - Internal error: file:/C:/CA132XOG/bin/test.javascript:;javascript:;xml:159:87: <gel:set> Missing or invalid XML. Here is the issue.



  <!-- Log out of the XOG -->
   



</gel:script>

 

 

If i replace ${mgr} in <gel:set value="${mgr}" select="$xogresponse//@managerResourceID"/> with a hard coded text value like 'ABDC' like below, the managerResourceID attribute gets updated and he gel script runs without errors.

 

<gel:set value="ABDC" select="$xogresponse//@managerResourceID"/>

 

Not sure if i am missing something. Ideas?

 

regards,

D.

Outcomes