AnsweredAssumed Answered

Setting a Date value in XOG in GEL?

Question asked by sdn on Nov 1, 2010
Latest reply on Oct 18, 2012 by splogad
Hi - I'm having problems setting a date value in my XOG xml. Here's my xml to get the current date into a format:


<core:new var="currentDate" className="java.util.Date"/>

<core:new className="java.text.SimpleDateFormat" var="format">


<core:arg type="java.lang.String" value="MM/dd/yy" />

</core:new>

<core:invokeStatic className="java.util.TimeZone" method="getTimeZone" var="timezone">


<core:arg type="java.lang.String" value="PST" />

</core:invokeStatic>

<core:invoke on="${format}" var="formattedDate" method="setTimeZone">


<core:arg type="java.util.TimeZone" value="${timezone}" />

</core:invoke>

<core:invoke on="${format}" var="formattedDate" method="format">


<core:arg type="java.util.Date" value="${currentDate}" />

</core:invoke>


However, when I try to set a task or assignment end date, it doesn't get set:

<sql:query dataSource="${clarityDS}" var="resourcesresult">


select res_code


from ODF_TEAM_V2


where prprojectid = ${projectIntID}
</sql:query>
<core:forEach items="${resourcesresult.rows}" trim="true" var="row">
<core:set value="${row.get('res_code')}" var="resourceID"/>
<gel:parse var="newResourceNode">



<Resource availTo="${formattedDate}" bookingStatus="5"




openForTimeEntry="false" resourceID="${resourceID}">



</Resource>


</gel:parse>


<gel:set select="$xogquery/NikuDataBus/Projects/Project/Resources" value="${newResourceNode}" insert="true"/>

</core:forEach>



<!-- Get tasks and assignments for the project -->
<sql:query dataSource="${clarityDS}" var="result">


select pa.PRID, pa.PRTASKID, pa.prresourceid


from niku.ODF_TASK_V2 t


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


where t.prprojectid = ${projectIntID}


order by PRTASKID
</sql:query>
<gel:log>Executed query</gel:log>
<core:forEach items="${result.rows}" trim="true" var="row">
<core:set value="${row.get('PRTASKID')}" var="taskID"/>
<core:set value="${row.get('prresourceid')}" var="taskResourceID"/>


<core:if test="${currentTaskID} == ${taskID}">



<!-- just add a new assignment node to the current task node -->



<gel:parse var="newAssignmentNode">




<TaskLabor[b] finish="${formattedDate}" remainingWork="0" resourceID="${taskResourceID}">




</TaskLabor>



</gel:parse>



<gel:set select='$xogquery/NikuDataBus/Projects/Project/Tasks/Task[@internalTaskID="${taskID}"]/Assignments' value="${newAssignmentNode}" insert="true"/>


</core:if>


<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">





<Assignments>
<TaskLabor finish="${formattedDate}"
remainingWork="0" resourceID="${taskResourceID}">
</TaskLabor>





</Assignments>




</Task>



</gel:parse>



<gel:set select="$xogquery/NikuDataBus/Projects/Project/Tasks" value="${newResourceNode}" insert="true"/>



<core:set value="${taskID}" var="currentTaskID"/>


</core:if>
</core:forEach>


I've tried various formats. Is there a required format to do this?

Thanks

Outcomes