none
problem with recalculate custom fields from psi RRS feed

  • Question

  •  

    Hello all. So, I need help.

    I try to recalculate all enterprise fields with formula's every night from PSI. But when formula uses field [Baseline Estimated Start] (or Finish) recalculating is wrong.

    My custom field "field1" use formula: IIf([Baseline Estimated Start] = ProjDateValue(0); "No baseline"; "There's baseline")

    So, in project I have two tasks and autocalculating option set off. Task 1 has baseline and "field1" has value "There's baseline". Then, for task 2 I also set baseline, but not press f9 and "field1" is blank yet. Then, I start my PSI-program to recalculate "field1" for both tasks. As a result, I have "field1" value "No baseline" instead "There's baseline" for both tasks".

    Any ideas?

    Code snippet:

                WebSvcProject.ProjectDataSet ProjectsList = ProjectSvc.ReadProjectList();
                foreach (WebSvcProject.ProjectDataSet.ProjectRow ProjectRow in ProjectsList.Project)
                {
                    bool CheckedOut = false;               
                    Guid SessionGuid = Guid.NewGuid();

                    ProjectSvc.CheckOutProject(ProjectRow.PROJ_UID, SessionGuid, String.Empty);
                    CheckedOut = true;

                    if (CheckedOut == true)
                    {
                        Guid JobUpdateGuid = Guid.NewGuid();
                        WebSvcProject.ProjectDataSet ProjectDs = ProjectSvc.ReadProject(ProjectRow.PROJ_UID, WebSvcProject.DataStoreEnum.WorkingStore);
                        ProjectSvc.QueueUpdateProject(JobUpdateGuid, SessionGuid, ProjectDs, false);
                        WaitForQueue(QueueSvc, JobUpdateGuid);

                        Guid JobPublishGuid = Guid.NewGuid();
                        ProjectSvc.QueuePublish(JobPublishGuid, ProjectRow.PROJ_UID, true, String.Empty);
                        WaitForQueue(QueueSvc, JobPublishGuid);

                        Guid JobCheckInGuid = Guid.NewGuid();
                        ProjectSvc.QueueCheckInProject(JobCheckInGuid, ProjectRow.PROJ_UID, false, SessionGuid, String.Empty);
                        WaitForQueue(QueueSvc, JobCheckInGuid);
                    }
                }

     

    And my second question is: how can I read Baseline Estimated Start value from PSI?
    Wednesday, August 24, 2011 12:27 PM

All replies

  • Hi MrNight - last question first - ProjectDataSet..::..TaskRow..::..TB_START may give you what you are looking for from the PSI. "Baseline start is the planned beginning date for the task at the time you saved a baseline."

    Looking at the code and also trying to repro using the ProjTool sample from the SDK I think the issue is that the without a recalc on the client the 2nd task may not even have a record for field1 and if you just try and update then nothing happens as there areno updates to make (the QueueUpdate is expecting to apply changes you make to the dataset and isn't quite the same as F9 would be on the client.  If however I force a change by for example adding some text to the name of Task 2 then it does have something to update - and then I see a new custom field row get added to my dataset and it has the true value.Hope this helps understand how the server scheduling and calculation works.

    Best regards,

    Brian


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Thursday, August 25, 2011 8:26 PM
    Owner
  • Hello, Brian.

    Unfortunatelly, described method also did't work. I add some text to names of all tasks in project, call QueueUpdate and QueuePublish and result is still bad: Task 2 has no value for "field1". Besides this, as I said early, the value of "field1" for Task1 (where value is calculated yet) resets to wrong value after QueueUpdate..

    Also in debug I see that TaskCustomFieldRow in DataSet for Task1 before QueueUpdate has his old right value "There's baseline", but after QueueUpdate TaskCustomFieldRow in DataSet has new wrong value "No baseline".

     

    So what can I do now? Any suggestions?

    Friday, August 26, 2011 6:55 AM
  • One more problem:

    I add even two custom fields: number field "field2" and number field "field3" with formula: [field2]*2.

    for task 2 I set field 2 value to 1 and still not recalculate project.

    After my code is complete, "field3" has right value 2! But "field1" with complex formula has the same behavior as previosly described in my posts.

    Friday, August 26, 2011 7:21 AM
  • A couple of things to try:

    instead of projdatevalue(0) try projdatevalue("NA") as the test.

    The other thing is that Baseline Estimated Start is string, not a date. Try using Baseline Start and see what happens.

    Jack Dahlgren blogs at:
    Project and Retrovention
    and rarely Twitter
    Friday, August 26, 2011 1:47 PM
    Moderator
  • Hi, Jack. I've tried this and also not work. I also try forula [Duration]*2 and it does't work too..

    Saturday, August 27, 2011 11:04 AM
  • Hello all. I'm still not find solution.

    Can you give me some more ideas?

    Tuesday, August 30, 2011 12:36 PM
  • Any ideas?
    Wednesday, September 7, 2011 8:47 AM
  • Hello.

     

    In my project i have same problem. In my code i change one value in task custom filed and this value is not connected with other fields. Then after the QueueUpdateProject from PSI all calulated fields are blank.

    Googling is helpless. Every post ends like your : "Any Ideas?".



    • Edited by BartosH Friday, September 16, 2011 12:05 PM
    Friday, September 16, 2011 12:02 PM
  • Hi BartosH,

    Which fields are you trying to use in your calculations?  I am reviewing some known issues and see potetnail issues with datediffs and calendars.

    Best regards,

    Brian


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Friday, September 16, 2011 2:47 PM
    Owner