AnsweredAssumed Answered

Dynamic XOG via GEL?

Question asked by Rob-FCB on Jul 19, 2013
Latest reply on Jul 23, 2013 by Rob-FCB
Here is what we are trying to do:

On the Idea module we have a subobject called Estimations where teams fill out an estimate that includes resource name, role, estimated hours, transaction class, and some other data.

We are writing a process with a gel script so that when the Idea is converted to a project, the data from the Estimations object is populated to the Team tab of the project as well as on an "Effort" task to load the ETC.

When I hardcoded the XOG portion with fixed rows of data, it worked.

The problem is, there will always be different numbers of estimations on each idea, so the script needs to loop through all of the estimation rows and populate the XOG file accordingly. This would be easily accomplished via a SSIS package where I could just use a Script component to manipulate the XML bening served but that is a more circuitious route and we'd prefer to have it fired off as soon as the proejct is created from the Idea.

As such, I have tried to put <core:forEach>******</core:forEach> blocks around the part of toe XOG query that are relevant but it does not work. No error is thrown, but I suspect that the <core:forEach> is not weolcome at this spot.

Example of what I'm doing:


<gel:setDataSource dbId="niku"/>
<sql:query escapeText="false" var="prjInf">
SELECT CODE, NAME, SCHEDULE_START, SCHEDULE_FINISH
FROM INV_INVESTMENTS
WHERE ID = ${projectID}
</sql:query>

<sql:query escapeText="false" var="tmEst">
SELECT RES_CODE, ROLE_CODE, ETC, START, FINISH
FROM FCB_TEAM_ESTIMATIONS_V
WHERE PRJ_INTERNAL_ID = ${projectID}
</sql:query>




<core:forEach items="${prjInf.rowsByIndex}" trim="true" var="p">
<core:set value="${p[0]}" var="prjNum"/>
<core:set value="${p[1]}" var="prjName"/>
<core:set value="${p[2]}" var="prjStart"/>
<core:set value="${p[3]}" var="prjFinish"/>
</core:forEach>



<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
<Header version="6.0.11" action="write" objectType="project" externalSource="NIKU"/>

<Projects>
<Project name="${prjName}" projectID="${prjNum}" format="11" start="${prjStart}" finish="${prjFinish}">
<Resources>

[color=#f10837] <core:forEach items="${tmEst.rowsByIndex}" trim="true" var="r"> [color]
<gel:log level="INFO">ResourceID: ${r[0]}</gel:log>
<Resource resourceID="${r[0]}" availFrom="${r[3]}" availTo="${r[4]}" openForTimeEntry="1" bookingStatus="5" requestStatus="1" defaultAllocation="0" projectRoleID="${r[1]}"/>
[color=#f10837] </core:forEach> [color]


</Resources>


So as you can see, I'm trying to build parts of the XOG dynamically by looping through the dataset and creating new Resource elements for as many exist.

However I suspect that since <core:forEach> is not part of the regular XOG world, it is not working because of that.

Outcomes