Clarity

Expand all | Collapse all

XML

Jump to Best Answer
  • 1.  XML

    Posted 03-12-2018 10:34 AM

    We have created a xog, in which we read an instance and xogged the same back in with a different version. In the first version from where i am reading, i have two time-varying columns.

    One column is enter manually. Now i want to copy the same to my second Time varying columns as well. how can i do it.

     

    Any suggestions would help. 



  • 2.  Re: XML

    Posted 03-12-2018 10:29 PM

    Hi, the basic concept I have used is:

    <gel:parse var="xogRootNode">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="15.2.0.213">
    <args name="overrideAutoNumbering" value="false"/>
    </Header>
    <customObjectInstances objectCode="cst_details_bud_hist">
    <instance grandparentInstanceCode="${v_selectedRow.code}" grandparentObjectCode="project" instanceCode="-1"
    objectCode="cst_details_bud_hist " parentInstanceCode="${v_selectedRow.cd_code}" parentObjectCode="cst_details">
    <CustomInformation>
    <ColumnValue name="name">${v_selectedRow.cd_name}</ColumnValue>
    <ColumnValue name="code">-1</ColumnValue>
    <ColumnValue name="tran_class_lu">${v_selectedRow.tran_class_lu}</ColumnValue>
    <ColumnValue name="cst_details_bud_lu">${v_selectedRow.ver_id}</ColumnValue>
    <ColumnValue name="cost_tsv">
    <tsvData default="0.0" finish="2060-01-01T00:00:00" start="1960-01-01T00:00:00" type="value"/>
    </ColumnValue>
    <ColumnValue name="page_layout">odf.cst_details_budFrame</ColumnValue>
    </CustomInformation>
    </instance>
    </customObjectInstances>
    </NikuDataBus>
    </gel:parse>
    <!--Run a query to find matching Cost record -->
    <sql:query var="v_query3result">
    SELECT
    cstdet.cst amount,
    to_char(cstdet.start_date, 'YYYY-MM-DD') start_date,
    to_char(last_day(cstdet.start_date), 'YYYY-MM-DD') end_date
    FROM odf_ca_cst_details cd
    left join
    ( select
    trunc(slice_date,'MON') start_date
    ,id id
    ,sum(slice) cst
    from ${v_table_name} sl
    join odf_ca_cst_details cd on sl.prj_object_id = cd.id and id = ${v_selectedRow.cd_id}
    group by trunc(slice_date,'MON'), id
    ) cstdet on cd.id = cstdet.id
    where cd.id = ${v_selectedRow.cd_id}


    </sql:query>
    <!-- no matching Cost record, log message -->
    <core:if test="${v_query3result.rowCount == 0}">
    <gel:log category="GEL" level="INFO">For transaction, no matching Cost record for : ${v_selectedRow.cd_code}</gel:log>
    </core:if>
    <core:forEach items="${v_query3result.rows}" var="v_row3">
    <!-- create Cost TSV segment for each row -->
    <gel:parse var="segmentNode">
    <segment finish="${v_row3.end_date}T00:00:00" isDefaultSegment="false" start="${v_row3.start_date}T00:00:00" value="${v_row3.amount}"/>
    </gel:parse>
    <gel:set insert="true" select="$xogRootNode//CustomInformation//ColumnValue[@name='cost_tsv']/tsvData" value="${segmentNode}"/>
    </core:forEach>
    <core:set value="${successes+1}" var="successes"/>

     

    You will have to adjust for you data, but it is basically reading the TSV data via SQL and then XOG'ing in using the multiple segment rows using the SQL data.



  • 3.  Re: XML
    Best Answer

    Posted 03-13-2018 06:47 AM

    Thanks Roland. I have used another method as mentioned below; After xogging the attribute,i  took the result in a varaible and repalce it using the below tag.

     

    <g:set value="${MyTSVfromOtherVarible}" select="$xogResponse_lead//NikuDataBus/customObjectInstances/instance/CustomInformation/ColumnValue[@name='my_attribute']/tsvData />.



  • 4.  Re: XML

    Posted 03-13-2018 09:36 PM

    I must try your approach one day.  Please mark your response as the correct one, so it will close out this topic.