AnsweredAssumed Answered

Using XPath in gel:set

Question asked by sdn on Nov 3, 2010
Latest reply on Jan 20, 2014 by gcubed
I am trying to create a XOG statement that updates Tasks and TaskLabor for tasks. The TaskLabor nodes are under the Task nodes, and I am trying to insert the TaskLabor nodes into the proper Task node by using XPath. I can't get the 'select' attribute of the gel:set statement to accept a variable in the XPath. Does anyone know how to do this? The code is below.
<!-- Get tasks and assignments for the project -->
<sql:query dataSource="${clarityDS}" var="tasksresult">

select pa.PRID, pa.PRTASKID, pa.prresourceid, t.PRWBSLevel

from niku.ODF_TASK_V2 t

inner join PRASSIGNMENT pa on pa.PRTASKID = t.odf_pk

where t.prprojectid = ${projectID}

order by PRTASKID
    </sql:query>
    <core:forEach items="${tasksresult.rows}" trim="true" var="row">
        <core:set value="${row.get('PRTASKID')}" var="taskID"/>
        <core:set value="${row.get('prresourceid')}" var="taskResourceID"/>
        <core:set value="${row.get('PRWBSLevel')}" var="outlineLevel"/>
        <core:if test="${currentTaskID != taskID}">
            <!-- create a new task node and a new assignment node -->
            <gel:parse var="newTaskAssignmentNode">
                <Task finish="${formattedDate}"
                internalTaskID="${taskID}"
                lockedForScheduling="true"
                status="2" percComp="1"
                outlineLevel="${outlineLevel}">
                    <Assignments>
                        <TaskLabor finish="${formattedDate}"
                            remainingWork="0" resourceID="${taskResourceID}">
                            <EstCurve>
                                <Segment finish="${formattedDate}" sum="0"/>
                            </EstCurve>
                        </TaskLabor>
                    </Assignments>
                </Task>
            </gel:parse>
            <gel:set select="$xogquery/NikuDataBus/Projects/Project/Tasks" value="${newTaskAssignmentNode}" insert="true" />
            <core:set value="${taskID}" var="currentTaskID"/>
        </core:if>
        <core:if test="${currentTaskID == taskID}">
            <!-- just add a new assignment node to the current task node -->
            <gel:parse var="newAssignmentNode">
                <TaskLabor finish="${formattedDate}" remainingWork="0" resourceID="${taskResourceID}">
                    <EstCurve>
                        <Segment finish="${formattedDate}" sum="0"/>
                    </EstCurve>
                </TaskLabor>
            </gel:parse>
            [color=#FF001E]<gel:set select="$xogquery/NikuDataBus/Projects/Project/Tasks/Task[@internalTaskID='${taskID}']/Assignments" value="${newAssignmentNode}" insert="true" />[/color]
        </core:if>
    </core:forEach>

Outcomes