Products
Applications
Support
Company
How To Buy
Skip to main content (Press Enter).
Sign in
Skip auxiliary navigation (Press Enter).
Register
Skip main navigation (Press Enter).
Toggle navigation
Search Options
Home
Communities
All Communities
Enterprise Software
Mainframe Software
Symantec Enterprise
Blogs
All Blogs
Enterprise Software
Mainframe Software
Symantec Enterprise
Events
All Events
Enterprise Software
Mainframe Software
Symantec Enterprise
VMware
Water Cooler
Groups
Enterprise Software
Mainframe Software
Symantec Enterprise
Members
Clarity
Private Community
View Only
Community Home
Threads
Library
Events
Members
Back to discussions
Expand all
|
Collapse all
Copy Data from Custom sub object to another custom sub object during Idea Conversion
1.
Copy Data from Custom sub object to another custom sub object during Idea Conversion
0
Recommend
Arunachalam Angusamy
Posted Jun 15, 2021 03:19 PM
Reply
Reply Privately
Options Dropdown
Hello Everyone,
I am trying to XOG OUT and XOG IN when the idea converted to a Project. I wrote a GEL Script but Segment section alone getting copied in one place. It should get to the second section of tsvData. Any inputs ?
GEL Script :
<gel:script xmlns:core="jelly:core" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:nikuq="http://www.niku.com/xog/Query" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xog="http://www.niku.com/xog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- <gel:parameter default="admin" var="xog_user"/> -->
<gel:parameter default="1" var="debug"/>
<!-- Define Data Source -->
<gel:setDataSource dbId="Niku" var="dbSource"/>
<sql:query dataSource="${dbSource}" var="initBy" escapeText="0">
<![CDATA[ select csu.user_name from bpm_run_processes brp
join cmn_sec_users csu on csu.id=brp.initiated_by
where brp.id=${gel_processInstanceId}
]]>
</sql:query>
<core:set var="xog_user" value="${initBy.rows[0].user_name}" />
<!--get the xog session id and persist it for later use-->
<core:catch var="xogLoginException">
<core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId"/>
<core:invokeStatic className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" var="userSessionCtrl"/>
<core:set value="${userSessionCtrl.init(xog_user, secId)}" var="secId"/>
<core:set value="${secId.getSessionId()}" var="xog_session_id"/>
</core:catch>
<core:choose>
<core:when test="${xog_session_id == null}">
<gel:log level="ERROR">User ${xog_user} cannot login to CA PPM ${xogLoginException.toString()} </gel:log>
</core:when>
<core:otherwise>
<gel:persist scope="INSTANCE" value="${xog_session_id}" var="xog_session_id"/>
<core:if test="${debug==1}">
<gel:log level="DEBUG">Xog session ID : ${xog_session_id}</gel:log>
</core:if>
</core:otherwise>
</core:choose>
<gel:log level="DEBUG"> Custom Subobject Instance ID : ${gel_objectInstanceId}</gel:log>
<gel:parse var="v_xog">
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
<Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.8"/>
<customObjectInstances objectCode="prj_fin">
</customObjectInstances>
</NikuDataBus>
</gel:parse>
<core:catch var="dbException">
<sql:query dataSource="${dbSource}" escapeText="false" var="on_hold">
<![CDATA[
SELECT odf.odf_parent_id,
(select inv.code from inv_investments inv where inv.idea_id = odf.odf_parent_id and odf_object_code='project') prj_id,
odf.bkngcode,
odf.highdig,
odf.mehier,
odf.respcode,
odf.prjppn,
odf.fin_dept,
odf.class,
odf.id,
odf.comments,
odf.code dep_destination_code,
odf.name dep_destination_name,
to_char(min(CST.start_date), 'YYYY-MM-DD') || 'T00:00:00' start_date,
to_char(max(CST.finish_date-1), 'YYYY-MM-DD') || 'T00:00:00' finish_date
FROM odf_ca_ida_fin odf
JOIN INV_INVESTMENTS INV on inv.id = odf.odf_parent_id
JOIN ODF_SSL_5080072 CST on CST.PRJ_Object_id = odf.id
where odf.odf_parent_id = ?
group by odf.odf_parent_id, odf.bkngcode, odf.highdig, odf.mehier, odf.respcode, odf.prjppn, odf.fin_dept, odf.class, odf.id, odf.comments,
odf.code, odf.name
]]>
<sql:param value="${gel_objectInstanceId}"/>
</sql:query>
<sql:query dataSource="${dbSource}" escapeText="false" var="data_class">
<![CDATA[ SELECT
odf.id,
to_char(CST.start_date, 'YYYY-MM-DD') || 'T00:00:00' start_date,
to_char((CST.finish_date-1), 'YYYY-MM-DD') || 'T00:00:00' finish_date,
round(CST.SLICE * ((CST.finish_date) - CST.start_date),0) slice
FROM odf_ca_ida_fin odf
JOIN INV_INVESTMENTS INV on inv.id = odf.odf_parent_id
JOIN ODF_SSL_5080072 CST on CST.PRJ_Object_id = odf.id
where odf.odf_parent_id = ${gel_objectInstanceId}]]>
</sql:query>
<gel:log>on_hold : ${on_hold.getRowCount()} </gel:log>
</core:catch>
<core:choose>
<!-- If there is an exception log it -->
<core:when test="${dbException != null}">
<gel:log level="ERROR">Database Error while querying data : ${dbException}</gel:log>
</core:when>
<core:otherwise>
<!-- <core:when test="${getLoggerID.rowCount eq 0}"> -->
<!-- set variables based upon query results -->
<core:forEach indexVar="i" items="${on_hold.rows}" var="on_hold">
<gel:log level="DEBUG">${on_hold.get('prj_id')}</gel:log>
<core:set value="${on_hold.get('prj_id')}" var="v_prjcode"/>
<core:set value="${on_hold.get('bkngcode')}" var="v_bkngcode"/>
<gel:log level="DEBUG">${on_hold.get('bkngcode')}</gel:log>
<core:set value="${on_hold.get('highdig')}" var="v_highdig"/>
<gel:log level="DEBUG">${on_hold.get('highdig')}</gel:log>
<core:set value="${on_hold.get('mehier')}" var="v_mehier"/>
<gel:log level="DEBUG">${on_hold.get('mehier')}</gel:log>
<core:set value="${on_hold.get('respcode')}" var="v_respcode"/>
<gel:log level="DEBUG">${on_hold.get('respcode')}</gel:log>
<core:set value="${on_hold.get('prjppn')}" var="v_prjppn"/>
<gel:log level="DEBUG">${on_hold.get('prjppn')}</gel:log>
<gel:log level="DEBUG">${on_hold.get('fin_dept')}</gel:log>
<core:set value="${on_hold.get('fin_dept')}" var="v_fin_dept"/>
<gel:log level="DEBUG">${on_hold.get('dep_destination_code')}</gel:log>
<core:set value="${on_hold.get('dep_destination_code')}" var="dep_destination_code"/>
<gel:log level="DEBUG">${on_hold.get('dep_destination_name')}</gel:log>
<core:set value="${on_hold.get('dep_destination_name')}" var="dep_destination_name"/>
<gel:log level="DEBUG">${on_hold.get('class')} </gel:log>
<core:set value="${on_hold.get('class')}" var="v_class"/>
<gel:log level="DEBUG">${on_hold.get('comments')} </gel:log>
<core:set value="${on_hold.get('comments')}" var="v_comments"/>
<core:if test="${dep_destination_code == null}">
<core:invokeStatic className="com.niku.odf.object.autonumbering.AutoNumberGenerator" method="getNextNumber" var="dep_destination_code">
<core:arg type="java.lang.String" value="prj_fin"/>
<core:arg type="java.lang.String" value="code"/>
<core:arg type="java.lang.String" value="NIKU.ROOT"/>
<core:arg type="java.lang.Number" value="${null}"/>
<core:arg type="com.niku.union.security.SecurityIdentifier" value="${null}"/>
<core:arg type="java.sql.Connection" value="${null}"/>
</core:invokeStatic>
</core:if>
<core:if test="${dep_destination_name == null}">
<core:invokeStatic className="com.niku.odf.object.autonumbering.AutoNumberGenerator" method="getNextNumber" var="dep_destination_name">
<core:arg type="java.lang.String" value="prj_fin"/>
<core:arg type="java.lang.String" value="name"/>
<core:arg type="java.lang.String" value="NIKU.ROOT"/>
<core:arg type="java.lang.Number" value="${null}"/>
<core:arg type="com.niku.union.security.SecurityIdentifier" value="${null}"/>
<core:arg type="java.sql.Connection" value="${null}"/>
</core:invokeStatic>
</core:if>
<gel:parse var="v_child_xml">
<instance instanceCode="${dep_destination_code}" objectCode="prj_fin" parentInstanceCode="${v_prjcode}" parentObjectCode="inv">
<CustomInformation>
<ColumnValue name="prjppn">${v_prjppn}</ColumnValue>
<ColumnValue name="code">${dep_destination_code}</ColumnValue>
<ColumnValue name="name">${dep_destination_name}</ColumnValue>
<ColumnValue name="bkngcode">${v_bkngcode}</ColumnValue>
<ColumnValue name="highdig">${v_highdig}</ColumnValue>
<ColumnValue name="mehier">${v_mehier}</ColumnValue>
<ColumnValue name="respcode">${v_respcode}</ColumnValue>
<ColumnValue name="prgm_name">${v_program_id}</ColumnValue>
<ColumnValue name="fin_dept">${v_fin_dept}</ColumnValue>
<ColumnValue name="comments">${v_comments}</ColumnValue>
<ColumnValue name="class">${v_class}</ColumnValue>
<ColumnValue name="cost">
<tsvData default="0.0" entityCode=" Inc." finish="${on_hold.get('finish_date')}" fiscalPeriodType="MONTHLY" isFiscal="true" start="${on_hold.get('start_date')}" type="value">
<core:forEach indexVar="j" items="${data_class.rows}" var="data_class">
<segment finish="${data_class.get('finish_date')}" isDefaultSegment="false" start="${data_class.get('start_date')}" value="${data_class.get('slice')}"/>
</core:forEach>
</tsvData>
</ColumnValue>
</CustomInformation>
</instance>
</gel:parse>
<gel:set insert="true" select="$v_xog/NikuDataBus/customObjectInstances" value="${v_child_xml}"/>
</core:forEach>
<!-- </core:when> -->
</core:otherwise>
</core:choose>
<!--
***************************************************************************************************************
*** Call XOG
********************************************************************************************************************
-->
<core:if test="${debug==1}">
<gel:log level="DEBUG">
<gel:expr select="$v_xog"/>
</gel:log>
</core:if>
<!-- call XOG -->
<core:catch var="xogException">
<soap:invoke endpoint="internal" var="result">
<soap:message>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<env:Header>
<xog:Auth>
<xog:SessionID>${xog_session_id}</xog:SessionID>
</xog:Auth>
</env:Header>
<env:Body>
<gel:include select="$v_xog"/>
</env:Body>
</env:Envelope>
</soap:message>
</soap:invoke>
</core:catch>
<core:choose>
<!-- If there is an exception log it -->
<core:when test="${xogException != null}">
<gel:log level="ERROR"> Error : ${xogException}</gel:log>
</core:when>
<!-- otherwise check if there is XOG errors or warnings -->
<core:otherwise>
<gel:set asString="true" select="$v_xog/NikuDataBus" var="XOG_INPUT"/>
<gel:set select="$result/env:Envelope/env:Body/XOGOutput" var="writeOutputRoot"/>
<gel:set asString="true" select="$writeOutputRoot" var="XOG_OUTPUT"/>
<gel:set asString="true" select="$writeOutputRoot/Status/@state" var="XOGoutcome"/>
<gel:set asString="true" select="$writeOutputRoot/Statistics/@totalNumberOfRecords" var="XOGtotalrecords"/>
<gel:set asString="true" select="$writeOutputRoot/Statistics/@insertedRecords" var="XOGinsertedrecords"/>
<gel:set asString="true" select="$writeOutputRoot/Statistics/@updatedRecords" var="XOGupdatedrecords"/>
<gel:set asString="true" select="$writeOutputRoot/Statistics/@failureRecords" var="XOGfailurerecords"/>
<core:if test="${debug==1}">
<gel:log level="DEBUG">XOGoutcome = ${XOGoutcome}</gel:log>
<gel:log level="DEBUG">XOGtotalrecords = ${XOGtotalrecords}</gel:log>
<gel:log level="DEBUG">XOGinsertedrecords = ${XOGinsertedrecords}</gel:log>
<gel:log level="DEBUG">XOGupdatedrecords = ${XOGupdatedrecords}</gel:log>
<gel:log level="DEBUG">XOGfailurerecords = ${XOGfailurerecords}</gel:log>
<gel:log level="DEBUG">XOG_INPUT = ${XOG_INPUT}</gel:log>
<gel:log level="DEBUG">XOG_OUTPUT = ${XOG_OUTPUT}</gel:log>
</core:if>
</core:otherwise>
</core:choose>
<!-- Logout -->
<core:if test="${xog_session_id != null}">
<soap:invoke endpoint="internal" 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 xmlns:xog="http://www.niku.com/xog/Object">
<xog:SessionID>${xog_session_id}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<xog:Logout/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</core:if>
</gel:script>
Result
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
<Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.8"/>
<customObjectInstances objectCode="prj_fin">
<instance instanceCode="00000046" objectCode="prj_fin" parentInstanceCode="PRJ01697" parentObjectCode="inv">
<CustomInformation>
<ColumnValue name="prjppn">00000</ColumnValue>
<ColumnValue name="code">00000046</ColumnValue>
<ColumnValue name="name">CSTPL000001F</ColumnValue>
<ColumnValue name="bkngcode">60</ColumnValue>
<ColumnValue name="highdig">4</ColumnValue>
<ColumnValue name="mehier">9</ColumnValue>
<ColumnValue name="respcode">20</ColumnValue>
<ColumnValue name="prgm_name"/>
<ColumnValue name="fin_dept">261</ColumnValue>
<ColumnValue name="comments">Test Comments 1</ColumnValue>
<ColumnValue name="class">1</ColumnValue>
<ColumnValue name="cost">
<tsvData default="0.0" entityCode="Inc." finish="2021-07-31T00:00:00" fiscalPeriodType="MONTHLY" isFiscal="true" start="2021-01-01T00:00:00" type="value">
<segment finish="2021-01-31T00:00:00" isDefaultSegment="false" start="2021-01-01T00:00:00" value="1000"/>
<segment finish="2021-02-28T00:00:00" isDefaultSegment="false" start="2021-02-01T00:00:00" value="2000"/>
<segment finish="2021-03-31T00:00:00" isDefaultSegment="false" start="2021-03-01T00:00:00" value="3000"/>
<segment finish="2021-04-30T00:00:00" isDefaultSegment="false" start="2021-04-01T00:00:00" value="4000"/>
<segment finish="2021-05-31T00:00:00" isDefaultSegment="false" start="2021-05-01T00:00:00" value="5000"/>
<segment finish="2021-06-30T00:00:00" isDefaultSegment="false" start="2021-06-01T00:00:00" value="6000"/>
<segment finish="2021-01-31T00:00:00" isDefaultSegment="false" start="2021-01-01T00:00:00" value="2000"/>
<segment finish="2021-02-28T00:00:00" isDefaultSegment="false" start="2021-02-01T00:00:00" value="3000"/>
<segment finish="2021-03-31T00:00:00" isDefaultSegment="false" start="2021-03-01T00:00:00" value="4000"/>
<segment finish="2021-04-30T00:00:00" isDefaultSegment="false" start="2021-04-01T00:00:00" value="5000"/>
<segment finish="2021-05-31T00:00:00" isDefaultSegment="false" start="2021-05-01T00:00:00" value="6000"/>
<segment finish="2021-06-30T00:00:00" isDefaultSegment="false" start="2021-06-01T00:00:00" value="7000"/>
<segment finish="2021-07-31T00:00:00" isDefaultSegment="false" start="2021-07-01T00:00:00" value="8000"/>
</tsvData>
</ColumnValue>
</CustomInformation>
</instance>
<instance instanceCode="00000045" objectCode="prj_fin" parentInstanceCode="PRJ01697" parentObjectCode="inv">
<CustomInformation>
<ColumnValue name="prjppn">00000</ColumnValue>
<ColumnValue name="code">00000045</ColumnValue>
<ColumnValue name="name">CSTPL000001D</ColumnValue>
<ColumnValue name="bkngcode">54</ColumnValue>
<ColumnValue name="highdig">8</ColumnValue>
<ColumnValue name="mehier">5</ColumnValue>
<ColumnValue name="respcode">18</ColumnValue>
<ColumnValue name="prgm_name"/>
<ColumnValue name="fin_dept">259</ColumnValue>
<ColumnValue name="comments">Test copy functionality</ColumnValue>
<ColumnValue name="class">1</ColumnValue>
<ColumnValue name="cost">
<tsvData default="0.0" entityCode="Cummins Inc." finish="2021-06-30T00:00:00" fiscalPeriodType="MONTHLY" isFiscal="true" start="2021-01-01T00:00:00" type="value"/>
</ColumnValue>
</CustomInformation>
×
New Best Answer
This thread already has a best answer. Would you like to mark this message as the new best answer?
Copyright 2019. All rights reserved.
Powered by Higher Logic