none
Unable to update task actual start and actual/remaining duration using PSI RRS feed

  • Question

  • Hi,
    I'm trying to develop a seemingly simple application using PSI web services for Project Server 2010.
    I simply need to update the actual start of an existing task and its actual/remaining duration, expressed as working days. The goal of this is to accordingly update its percentage of completion.

    I'll show you my failed attempts (I used the project web service):

    1) I tried to set the actual start (TASK_ACT_START), total duration (TASK_DUR) and the remaining duration (TASK_REM_DUR). TASK_ACT_DUR is a read-only calculated field, so it cannot be set.
    This is the code:

    oTskRow.TASK_ACT_START = new DateTime(dActStartDate.Year, dActStartDate.Month, dActStartDate.Day, 9, 0, 0);
    oTskRow.TASK_DUR = (iDur * 8 * 60 * 10);  // durations are expressed as minutes * 10
    oTskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
    oTskRow.TASK_REM_DUR = (iRemDur * 8 * 60 * 10);

    dActStartDate is the actual start date to set, iDur is the total duration (actual + remaining), iRemDur is the remaining duration, both expressed in working days. So I expect my actual duration will be: iDur - iRemDur.
    When i open my project using Project Professional I can see no actual start for the task, neither its actual and remaining duration. Actually it seems to me that PSI save all the correct data (I read the project again to verify this) but Project Professional simply seems to ignore those fields saved by PSI. The funny thing is that PSI doesn't throw any error when calling the QueueUpdateProject method.

    2) My second attempt was to set the actual start, the total duration and the percentage of completion field (TASK_PCT_COMP). This is the code:

    oTskRow.TASK_ACT_START = new DateTime(dActStartDate.Year, dActStartDate.Month, dActStartDate.Day, 9, 0, 0);
    oTskRow.TASK_DUR = (iDur * 8 * 60 * 10);
    oTskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
    oTskRow.TASK_PCT_COMP = (int)Math.Round((Convert.ToDouble(iActDur) / Convert.ToDouble(iDur)) * 100.0);

    iActDur is the actual duration of the task, expressed in working days.
    This code seems to work (Project Pro show the correct actual start date and % of completion for the task) but obviously actual duration and remaining duration values are approximated, and I need them to be precise values.
    E.G: task total duration is 17 days, the actual duration I want to set is 6 days and remaining duration is 11 days. The calculated TASK_PCT_COMP will be obviously 35, but at the end of QueueUpdateProject method TASK_ACT_DUR = 28560 (5.95 days) and TASK_REM_DUR = 53040 (11.05 days). Project Pro will show the same decimal values for the durations.

    3) My third (and weirdest) attempt was the same as above, adding the statement to specify the remaining duration, like in the first attempt:

    oTskRow.TASK_ACT_START = new DateTime(dActStartDate.Year, dActStartDate.Month, dActStartDate.Day, 9, 0, 0);
    oTskRow.TASK_DUR = (iDur * 8 * 60 * 10);
    oTskRow.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
    oTskRow.TASK_PCT_COMP = (int)Math.Round((Convert.ToDouble(iActDur) / Convert.ToDouble(iDur)) * 100.0);
    oTskRow.TASK_REM_DUR = (iRemDur * 8 * 60 * 10);

    I thought that could adjust the calculated actual duration to the value I needed, but it was a wrong hope.
    Actually QueueUpdateProject method correctly changed the value of TASK_REM_DUR to 52800 (11*8*60*10 = 11 working days), but it didn't change the TASK_ACT_DUR (that remains 28560, or 5.95 days). Weirdly it changed the TASK_DUR value instead, setting it to 81360 (or 16.95 days), even though I explicitly set this to 17*8*60*10 = 81600!! In short it didn't add to TASK_ACT_DUR the difference. Why this??

    I even tried to adjust the work fields (TASK_WORK, TASK_ACT_WORK, TASK_REM_WORK) to solve my problem but all I obtained were strange behaviors when trying to save the project with PSI. Maybe I did it in the wrong way, I don't know.

    What is the right way to get my code work? Am I missing something?

    I'm really having a lot of problems for this issue and I hope someone will help me.
    Thanks in advance.

    Friday, January 10, 2014 8:02 PM

All replies

  • Thanks a lot for your silent help!

    Tuesday, November 11, 2014 5:54 PM
  • Hi dmin,

    I am sorry no one have seen/answered your question since January.

    I have been struggling with similar problems, and i do not see this as an issue in PSI but in our understanding of the Project Calculation Engine (setting the value of one field might affect other fields, depending on the task Constraint/Task type/number of assignments/etc.).

     

    What i usually do is to try and simulate what I want to do in the MS Project Client. Enable the Details under Ribbon->TASK->Properties. Create a task with resources/assignments and then update the fields to see what actually happens.

    Be aware that some fields in the Client are reverse calculated, ex. setting Finish results in duration to change (which PSI does not support).

    Will try and get time to recreate your problem. As i understand it you are just trying to set the % Completed (or is it % Work Completed)


    http://technicaltrix.blogspot.dk/

    Wednesday, November 12, 2014 9:56 AM