Clarity

Expand all | Collapse all

Remove allocation using gel script

  • 1.  Remove allocation using gel script

    Posted Jun 07, 2017 03:24 AM

    How would i be able to remove all future allocations of a resource through gel  scripting?



  • 2.  Re: Remove allocation using gel script

    Posted Jun 09, 2017 10:42 PM

    You would XOG out the resource, determine how to modify the XOG output to adjust the allocation the way you want it to be represented, then XOG it back in again and check that you got the desired result in PPM.

     

    If you can, then the same thing can be carried out within GEL.



  • 3.  Re: Remove allocation using gel script

    Posted Oct 27, 2017 12:05 AM

    i have never actually written XOG in gel script. Could you help me with a sample of how i could do it for this?



  • 4.  Re: Remove allocation using gel script

    Posted Oct 27, 2017 04:03 AM

    Kajal.Rane wrote:

     

    i have never actually written XOG in gel script. Could you help me with a sample of how i could do it for this?

    There are sample GEL scripts in the Gel.zip file attached to the FAQ thread ; here

    (the 'Basic guide to getting started with GEL' document contains XOG examples)



  • 5.  Re: Remove allocation using gel script

    Posted Jun 12, 2017 07:10 AM

    Why do you want to remove future allocations? If you want that future allocation shouldn't appear in some of the views( Team, Allocation Portlet) then you should reduce the Project Finish Date otherwise you xogout allocations and xogin after making the necessary modifications.



  • 6.  Re: Remove allocation using gel script

    Posted Oct 27, 2017 12:05 AM

    we do not want to change the finish date only remove the allocation.

    i have never actually written XOG in gel script. Could you help me with a sample of how i could do it for this?



  • 7.  Re: Remove allocation using gel script

    Posted Oct 27, 2017 03:31 AM

    This has to be achieved using an XML template in the GEL script.

     

    Examples

    Updating Team data using custom process

    Bulk Update of Staff Obs Unit in Project's Team



  • 8.  Re: Remove allocation using gel script

    Posted Oct 27, 2017 06:37 AM

    If you are saying you do not want any allocation it could be easier to do that when you create the project and project team.

    If you are saying you do not any allocations after a given point in the project life cycle, what determines that point? That is when does future start?



  • 9.  Re: Remove allocation using gel script

    Posted Nov 01, 2017 02:09 AM

    We would like to remove allocation after suppose today's date i.e when the process through which we want to update runs.



  • 10.  Re: Remove allocation using gel script

    Posted Nov 13, 2017 01:54 AM

    Will my before script work? no sure of it for removal of allocation?

     

    <core:when test="${result.rowCount > 0}">
    <gel:log>Result greater than 1!</gel:log>
    <gel:parse var="ProjXML">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="13.3"/>
    <Projects>
    <Project name="${result.rows[0].name}" projectID="${result.rows[0].code}">
    <Tasks/>
    </Project>
    </Projects>
    </NikuDataBus>
    </gel:parse>
    <core:forEach items="${result.rows}" var="eachTsk">
    <gel:parse var="eachTskXml">
    <Task finish="${eachTsk.prfinish}T17:00:00" name="${eachTsk.prname}" outlineLevel="${eachTsk.prwbslevel}" percComp="1"
    start="${eachTsk.prstart}T08:00:00" status="2" taskID="${eachTsk.prexternalid}">
    <Assignments/>
    </Task>
    </gel:parse>
    <!-- QUERY to pull assignments -->
    <sql:query escapeText="0"
    var="result1"><![CDATA[
    select
    s.unique_name, REPLACE(CONVERT(VARCHAR(10),isnull(a.prstart,t.prstart), 111), '/', '-') seg_start,
    REPLACE(CONVERT(VARCHAR(10),isnull(a.prfinish,t.prfinish), 111), '/', '-') seg_finish
    from prtask t
    join prassignment a on t.prid = a.prtaskid
    join srm_resources s on a.prresourceid = s.id
    where prtaskid = ?
    ]]><sql:param value="${eachTsk.prid}"/>
    </sql:query>
    <core:forEach items="${result1.rows}" var="eachSeg">
    <gel:parse var="segXML">
    <TaskLabor remainingWork="0" resourceID="${eachSeg.unique_name}">
    <EstCurve>
    <Segment finish="${eachSeg.seg_finish}T17:00:00" start="${eachSeg.seg_start}T08:00:00" sum="0.0000"/>
    </EstCurve>
    </TaskLabor>
    </gel:parse>
    <gel:set insert="true" select="$eachTskXml//Task/Assignments" value="${segXML}"/>

    <gel:parse var="segalloacXML">
    <TaskLabor remainingWork="0" resourceID="${eachSeg.unique_name}">
    <AllocCurve>
    <Segment finish="${eachSeg.seg_finish}T17:00:00" start="${eachSeg.seg_start}T08:00:00" sum="0.0000"/>
    </AllocCurve>
    </TaskLabor>
    </gel:parse>
    <gel:set insert="true" select="$eachTskXml//Task/Allocation" value="${segalloacXML}"/>
    </core:forEach>
    <gel:set insert="true" select="$ProjXML//Projects/Project/Tasks" value="${eachTskXml}"/>
    </core:forEach>



  • 11.  Re: Remove allocation using gel script

    Posted Nov 13, 2017 02:48 AM

    Allocation is associated with the 'Team' area of a Project

    Assignments is associated with the 'Task' area of a Project.

    Can you be specific on what you are trying to remove?

     

    If it Tasks Assignments, then look at the sample scripts that come with XOG (or XOG down an existing Project including Tasks).  The format is like:

    <Task name="task3" taskID="taskID3" outlineLevel="1">
    <Assignments>
    <TaskLabor resourceID="joeTime" actualThrough="2003-01-01T00:00:00" estPattern="2" basePattern="3" estMax="1" baseMax="2" pendEstSum="6" pendActSum="4" pendStart="2003-02-01T00:00:00" pendFinish="2004-01-01T00:00:00">
    <Curve>
    <Segment start="2003-01-01T00:00:00" finish="2003-03-01T00:00:00" sum="5"/>
    <Segment start="2003-04-01T00:00:00" finish="2003-06-01T00:00:00" sum="4"/>
    </Curve>
    </TaskLabor>
    </Assignments>
    </Task>

    Above 'Cut and Pasted' directly from the sample XOG files.  It doesn't match what you are attempting to create as an XML file.  Where did you get your script from?



  • 12.  Re: Remove allocation using gel script

    Posted Nov 13, 2017 03:30 AM
      |   view attached

    i actually want to zero out allocation after a particular date for all the resources of a project.

    I already had an implementation in one of our process to remove the ETCs. i need to incorporate tin the same process the removal of Allocations too.

    Attached is the process i already have and i need to add the allocation part of requirement to it.

    Attachment(s)

    docx
    gel.docx   37 KB 1 version


  • 13.  Re: Remove allocation using gel script

    Posted Nov 13, 2017 04:02 AM

    Kajal, if the Task Estimates are correct, why don't you just run  the job Update Allocation from Estimates?

     

    Have you looked at the sample XOG file prj_projects_alloc_act_etc_write, which will have the format required, including Tasks and Team (aka Resources).

     

    As indicated earlier, when updating the Team, I only have undertaken using a XML Template, but your case is different and hopefully prj_projects_alloc_act_etc_write will give you the format required.



  • 14.  Re: Remove allocation using gel script

    Posted Nov 13, 2017 06:07 AM

    Is Update Allocations from Estimates going to work from all tasks or just Effort task?



  • 15.  Re: Remove allocation using gel script

    Posted Nov 15, 2017 03:43 PM

    Allocate from Estimates should work for all tasks (Estimate from Allocations is only for the ~rmw task in Fast Plans and NPIO).

     

    If the ETC has already been dropped to 0 after a certain date, running the Update Allocations from Estimates job is the easiest path forward.

     

    Otherwise, one has to build the Project XOG  and set the team segments from arbitrary date to project end = 0.

    (you'll still need to figure out what to do with the allocation segments that go across the arbitrary date as they need to be shrunk based on the number of workdays in the calendar between segment start and arbitrary date). 



  • 16.  Re: Remove allocation using gel script

    Posted Nov 15, 2017 04:15 PM

    Thanks.

    See

    Automation of Allocation From Estimates 

    for more details on how it works.



  • 17.  Re: Remove allocation using gel script

    Posted Nov 21, 2017 03:37 AM

    i saw that xml and came up with the below to zero out allocations and ETCs for all the resource for that project. could anyone let me know if it is correct? or i need to make any changes? 

     

    <!-- QUERY to to pull tasks -->
    <sql:query escapeText="0"
    var="result"><![CDATA[
    select i.id, i.code, i.name,
    t.prid, t.prexternalid, t.prname, REPLACE(CONVERT(VARCHAR(10), t.prstart, 111), '/', '-') prstart,
    REPLACE(CONVERT(VARCHAR(10), t.prfinish, 111), '/', '-') prfinish, t.prstatus, t.prpctcomplete, t.prwbslevel
    from inv_investments i
    join prtask t on i.id = t.prprojectid
    join odf_ca_task oct on oct.id = t.prid
    where i.id = ?
    and (oct.kc_cost_adj = 0 or oct.kc_cost_adj is null)
    ]]><sql:param value="${gel_objectInstanceId}"/>
    </sql:query>
    <core:choose>
    <core:when test="${result.rowCount > 0}">
    <gel:log>Result greater than 1!</gel:log>
    <gel:parse var="ProjXML">
    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
    <Header action="write" externalSource="NIKU" objectType="project" version="13.3"/>
    <Projects>
    <Project name="${result.rows[0].name}" projectID="${result.rows[0].code}">
    <Tasks/>
    </Project>
    </Projects>
    </NikuDataBus>
    </gel:parse>
    <core:forEach items="${result.rows}" var="eachTsk">

    <gel:parse var="eachTskXml">
    <Task finish="${eachTsk.prfinish}T17:00:00" name="${eachTsk.prname}" outlineLevel="${eachTsk.prwbslevel}" percComp="1"
    start="${eachTsk.prstart}T08:00:00" status="2" taskID="${eachTsk.prexternalid}">
    <Assignments/>
    </Task>
    </gel:parse>
    <!-- QUERY to pull assignments -->
    <sql:query escapeText="0"
    var="result1"><![CDATA[
    select
    s.unique_name, REPLACE(CONVERT(VARCHAR(10),isnull(a.prstart,t.prstart), 111), '/', '-') seg_start,
    REPLACE(CONVERT(VARCHAR(10),isnull(a.prfinish,t.prfinish), 111), '/', '-') seg_finish
    from prtask t
    join prassignment a on t.prid = a.prtaskid
    join srm_resources s on a.prresourceid = s.id
    where prtaskid = ?
    ]]><sql:param value="${eachTsk.prid}"/>
    </sql:query>
    <core:forEach items="${result1.rows}" var="eachSeg">
    <gel:parse var="segXML">


    <TaskLabor remainingWork="0" resourceID="${eachSeg.unique_name}">
    <EstCurve>
    <Segment finish="${eachSeg.seg_finish}T17:00:00" start="${eachSeg.seg_start}T08:00:00" sum="0.0000"/>
    </EstCurve>
    </TaskLabor>
    </gel:parse>
    <gel:set insert="true" select="$eachTskXml//Task/Assignments" value="${segXML}"/>


    <gel:parse var="segresXML">
    <Resource resourceID="${eachSeg.unique_name}">
    <AllocCurve>
    <Segment finish="${eachSeg.seg_finish}T17:00:00" start="${eachSeg.seg_start}T08:00:00" sum="0.0000"/>
    </AllocCurve>
    </Resource>
    </gel:parse>

    </core:forEach>


    <gel:set insert="true" select="$ProjXML//Projects/Project/Tasks" value="${eachTskXml}"/>
    <gel:set insert="true" select="$ProjXML//Projects/Project/Resources" value="${segresXML}"/>
    </core:forEach>

    <gel:log>