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.