Hi All,
Following my last post (http://www.planningplanet.com/forums/asta-powerproject/537680/using-formula-answer-another-formula). I’ve realised I need help with the actual formula;
I have a programme with multiple tasks per line / bar, with each task on a line having a different code library allocation. The bars are set so that tasks may overlap.
I’m trying to get the duration (start to finish – not cumulative) between the start of a task with Code Library Allocation “A”, and the finish of a task with Code Library Allocation “D”. The tasks don’t appear at the same task number (in the line), so I don’t think I can use the task number object selection.
Code Library has object id 35
Code Library Allocation A has object id 167652
Code Library Allocation D has object id 167654
The formula that I’d got to is below, but although the status is OK, it doesn’t give the answer is was after;
DateDiff(Task.CodeLibrary(35, 0, 167652).Start, Task.CodeLibrary(35, 0, 167654).Finish)
I’ve tried since tried simplifying it in stages but they don’t seem to work either;
Should give the start of task code library allocation A (object id 167652).
Task.CodeLibrary(35, 0, 167652).Start
Should give the finish of task with code library allocation D (object id 167654);
Task.CodeLibrary(35, 0, 167654).Finish
Any help would be appreciated
Kind regards,
Chris
Thanks for this Chris, looks like i wasn't even close so would never have got there.
Hi Chris,
I saw this question from the support team, the answer is as follows:
To get the formula to find the start date on a specific task with an assigned code library, you will need to check each task. the snippet below returns the start date of a task with a code library called "A" from the codelibary 'Default' ID 35
Switch(
Task[>1].TaskCodeLibrary(35, 0, na)="A",Task[>1].Start,
Task[>2].TaskCodeLibrary(35, 0, na)="A",Task[>2].Start,
Task[>3].TaskCodeLibrary(35, 0, na)="A",Task[>3].Start,
Task[>4].TaskCodeLibrary(35, 0, na)="A",Task[>4].Start,
Task[>5].TaskCodeLibrary(35, 0, na)="A",Task[>5].Start,
Task[>6].TaskCodeLibrary(35, 0, na)="A",Task[>6].Start,
Task[>7].TaskCodeLibrary(35, 0, na)="A",Task[>7].Start,
Task[>8].TaskCodeLibrary(35, 0, na)="A",Task[>8].Start)
You can then combine this with a search for the finish date in the same way and then perform a DateDiff on it.
(DateDiff(
(Switch(
Task[>1].TaskCodeLibrary(35, 0, na)="A",Task[>1].Start,
Task[>2].TaskCodeLibrary(35, 0, na)="A",Task[>2].Start,
Task[>3].TaskCodeLibrary(35, 0, na)="A",Task[>3].Start,
Task[>4].TaskCodeLibrary(35, 0, na)="A",Task[>4].Start,
Task[>5].TaskCodeLibrary(35, 0, na)="A",Task[>5].Start,
Task[>6].TaskCodeLibrary(35, 0, na)="A",Task[>6].Start,
Task[>7].TaskCodeLibrary(35, 0, na)="A",Task[>7].Start,
Task[>8].TaskCodeLibrary(35, 0, na)="A",Task[>8].Start))
,
(Switch(
Task[>1].TaskCodeLibrary(35, 0, na)="B",Task[>1].Finish,
Task[>2].TaskCodeLibrary(35, 0, na)="B",Task[>2].Finish,
Task[>3].TaskCodeLibrary(35, 0, na)="B",Task[>3].Finish,
Task[>4].TaskCodeLibrary(35, 0, na)="B",Task[>4].Finish,
Task[>5].TaskCodeLibrary(35, 0, na)="B",Task[>5].Finish,
Task[>6].TaskCodeLibrary(35, 0, na)="B",Task[>6].Finish,
Task[>7].TaskCodeLibrary(35, 0, na)="B",Task[>7].Finish,
Task[>8].TaskCodeLibrary(35, 0, na)="B",Task[>8].Finish))
))