michael.f.brunak

Help needed converting writing Clarity data into new sub-object

Discussion created by michael.f.brunak on Nov 29, 2010
Latest reply on Nov 30, 2010 by samos
Hello,

I have a working GEL script which is triggered by a flag on a custom object. The GEL script essentially copies the entire contents of the object, and sets 1 unique value to make the record unique.

I have several sub-object attributes of different types (Large String, Date, Lookup-Number).

The new object is created correctly. However, the contents of the Large String (40 characters) are not being copied to the new object attribute. Instead, a reference to "com.ca.clarity.jdbc.base.BaseClob@e7403" appears. The SQL query in the GEL script pulls data directly from the Clarity database, and the XOG in the GEL script writes the same data back into Clarity.

Do I need to invoke functions or API's to convert the Long String data so that it can be written with XOG?

thanks!!

Mike
<gel:script 
xmlns:x="jelly:xml" 
xmlns:core="jelly:core" 
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" 
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" 
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:sql="jelly:sql"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<gel:setDataSource dbId="Niku"/>
<gel:parameter default="http://rpmpoc:81" var="XOGURL"/>
<gel:parameter var="XOGusername" default="admin"/>
<gel:parameter var="XOGpassword" default="rpmrpmrpm"/>

<sql:query var="project_query">

select snap.code, snap.name, snap.partition_code, snap.odf_parent_id, snap.odf_cncrt_parent_id, 

snap.created_date, snap.created_by, snap.last_updated_by, inv.code, snap.accomp


from niku.odf_ca_project_snapshot snap, NIKU.inv_investments inv


where snap.cp_prj_stat = 1


and snap.odf_parent_id = inv.id


and snap.id = ${gel_objectInstanceId}
</sql:query>

<core:forEach items="${project_query.rowsByIndex}" trim="true" var="row">
    <core:forEach var="field" items="${project_query.columnNames}" indexVar="i">
        <core:set value="${row}" var="${field}"/>
</core:forEach>
</core:forEach>

<soap:invoke endpoint="${XOGURL}/niku/xog" var="xog_login">

<soap:message>


<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">



<soap-env:Body>




<xog:Login xmlns="http://www.niku.com/xog">





<xog:Username>${XOGusername}</xog:Username>





<xog:Password>${XOGpassword}</xog:Password>




</xog:Login>



</soap-env:Body>


</soap-env:Envelope>

</soap:message>
</soap:invoke>

<gel:set var="sessionID" asString="true" select="$xog_login/soap-env:Envelope/soap-env:Body/xog:SessionID/text()"/>

<core:choose>


<core:when test="${sessionID == null}">



<gel:out>Couldn't Log in. Check the username/password.</gel:out>


</core:when>

<core:otherwise>


<gel:out> <gel:expr select="$xog_login"/> </gel:out>



<soap:invoke endpoint="${XOGURL}/niku/xog" var="XOG_result">



<soap:message>




<soap-env:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">





<soap-env:Header>






<xog:Auth><xog:SessionID>${sessionID}</xog:SessionID></xog:Auth>





</soap-env:Header>





<soap-env:Body>

<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">

<Header action="write" externalSource="NIKU" objectType="customObjectInstance" overrideAutoNumbering="0" version="12.0.6.5471"/>
<customObjectInstances objectCode="project_snapshot">
<instance instanceCode="-1" objectCode="project_snapshot" parentInstanceCode="${row[8]}" parentObjectCode="project">
<CustomInformation>
<ColumnValue name="code">AUTO-CODE</ColumnValue>
<ColumnValue name="name">Status Report</ColumnValue>
<ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>









<ColumnValue name="accomp">${row[9]}</ColumnValue>
</CustomInformation>
</instance>
</customObjectInstances>
</NikuDataBus>






</soap-env:Body>




</soap-env:Envelope>



</soap:message>


</soap:invoke>





<!-- ================================================= -->
<!-- Error/status reporting - optional -->
<!-- ================================================= -->
<gel:set asString="true" select="$XOG_result/soap-env:Envelope/soap-env:Body/XOGOutput/Status/@state" var="XOG_STATUS"/>
<gel:set asString="true" select="$XOG_result/soap-env:Envelope/soap-env:Body/XOGOutput/Statistics/@insertedRecords" var="XOG_insertedRecords"/>

<core:switch on="${XOG_STATUS}">
<core:case value="SUCCESS">
<core:if test="${XOG_insertedRecords == '1'}">
<gel:out>${XOG_STATUS}! ${i} Project ID ${row[8]} Accomp ${row[9]}</gel:out>
</core:if>
<core:if test="${XOG_insertedRecords == '0'}">
<gel:out> VALIDATION ERROR!! === &gt;<gel:expr select="$XOG_result"/> </gel:out>
</core:if>
</core:case>
<core:case value="FAILURE">
<gel:out> ${XOG_STATUS}
</gel:out>
<gel:out> <gel:expr select="$XOG_result"/> </gel:out>
</core:case>
<core:default>
<gel:out>${XOG_STATUS} - Couldn't find XOG output summary. <gel:expr select="$XOG_result"/> </gel:out>
</core:default>
</core:switch>
<!-- ======= end error reporting ===================== -->


</core:otherwise>
</core:choose>

<soap:invoke endpoint="${XOGURL}/niku/xog" var="xog_logout">

<soap:message>


<soap-env:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">



<soap-env:Header>




<xog:Auth><xog:SessionID>${sessionID}</xog:SessionID></xog:Auth>



</soap-env:Header>



<soap-env:Body>




<xog:Logout/>



</soap-env:Body>


</soap-env:Envelope>

</soap:message>
</soap:invoke>

<gel:out> <gel:expr select="$xog_logout"/> </gel:out>

</gel:script>

Outcomes