none
Project Server 2010 PWA Formula - Run Once Only RRS feed

  • Question

  • Hi,

    Is it possible to define a formula driven field that is only run the one time?

    For example, in a Task Date formula driven field named [Set Start]: IIf(Int([Created]) = Int(Now()), [Start], "")

    I need the [Start] date to be captured when the Task is created, which this will accomplish. But the next time th Project is Published, I don't want the formula to calculate, as it will set the field value to "".

    However, I can't retain the value the same, as using [Set Start] instead of "" for the final attribute will cause a circular reference.

    Any suggestions on how to skip this test or to run the test, but keep the same value (that is [Start]), in the field, upon another Publish triggering the formula?

    Cheers,

    Wayne

    Saturday, April 6, 2013 7:17 AM

All replies

  • Hi,

    you can use a flag field as status to persist the state. A flag field has as default No, so you can set it to Yes if the created date has been written.

    Best,

    Renke


    http://www.holert.com Project Management with MS Project - Oldenburg, Berlin, Munich/Germany

    Sunday, April 7, 2013 5:02 PM
  • Hi Renke,

    Thanks very much for responding to my post an providing a possible solution to my need to persist the state of a field.

    Can you provide an example on how I'd use a Flag field to persist the state of another field?

    For instance, with the example I have above:  Task Date formula driven field named [Set Start]: IIf(Int([Created]) = Int(Now()), [Start], "")

    I'm not sure how I'd use the Flag field to allow me to persist the [Start] date to be that which is captured when the Task is created.

    Cheers,

    Wayne

    Sunday, April 7, 2013 11:33 PM
  • Hi,

    you can use the ProjectBeforePublish Event for this purpose.

    Best,

    Renke


    http://www.holert.com Project Management with MS Project - Oldenburg, Berlin, Munich/Germany

    Tuesday, April 9, 2013 6:05 PM
  • Hi Renke,

    Thanks for your further feedback. By using the 'ProjectBeforePublish' Event, I gather you mean using the PSI to capture that value that I need.

    That would certainly be an option, but my whole aim was to be able to accomplish this via a formula driven field.

    When it comes down to it, I guess the crux of what I'm having trouble with is capturing a value in a field and not have that value change the next time the formula runs due to another publish.

    It seems (and I've not noticed this before), that the most basic functionality of captruing a value and then leaving that value alone if nothing changes, is not available via the formula driven language. Because you can't reference the same field as the default value (due to circular reference errors), to say "please leave the value as is", you can't default the field to the existing value, unless I'm missing something.

    I am stumped on this one (aside from using the PSI), which is a shame, as it would really finalize a process I have been working on for quite some time.

    Cheers,

    Wayne

    Tuesday, April 9, 2013 6:30 PM
  • Hi,

    no, ProjectBeforePublish event is available in Project Client's VBA.

    Best,

    Renke


    http://www.holert.com Project Management with MS Project - Oldenburg, Berlin, Munich/Germany

    Wednesday, April 10, 2013 3:37 PM
  • Hi Renke,

    Oh, yes. I'm familiar with that Event, as I just wrote a whole lot of macros for this same client in Project Pro.

    Unfortunately, for this process, Project Pro is not an option. This is needed for Projects that will be managed compltely via the PWA Web Browser client. So either Formula Drive Fields or the PSI are my only options. And as I mentioend, I'd prefer to leverage the formula language if at all possible.

    I am just astounded that there seems to be no way with a Formula Driven Field to default that field to the existing value, provided all of the IIF or Switch tests in a formula evaluate to False and you don't want the existing value to change.

    This seems to me to be such a basic feature of any formula language.

    So if you know how to leverage the Flag field to persit and existing value in a field (or any other method), that's exactly what I need.

    Cheers,

    Wayne

    Wednesday, April 10, 2013 4:42 PM
  • Hi,

    as you said in this case you need to use a server side event handler. You can use the corresponding pre published event ProjectEventReceiver.OnPublishing: http://msdn.microsoft.com/en-us/library/office/gg228214(v=office.14).aspx

    Just very few lines of code.

    Best,

    Renke


    http://www.holert.com Project Management with MS Project - Oldenburg, Berlin, Munich/Germany

    Monday, April 22, 2013 5:31 PM