Elapsed duration

N

Newbie

Hello,
Is it possible to "read" in VBA if the Duration of a task is specified as
"elapsed" vs. standard working time duration ?

Thanks

Newbie
 
J

JackD

I can't recall, but some doing some date math should be able to give you a
clue about it. If the duration is equal to the finish - start then it would
be elapsed duration. Make sure you are not using the project date difference
function that takes the project calendar into account. Strict subtraction
and conversion into minutes should give you the value you need.
 
E

Earl Lewis

Newbie,

Duration is by definition the elapsed time between the start and end dates - in work days (or hours, minutes, weeks or months) depending on how you choose to display it.

However, the duration field holds the number of work minutes, calculated based on the selected task type, the amount of work and the resources assigned to it. Again, dependent on the selected task type and other task values.

Even though the field is primarily a data entry field it will calculate (and recalculate) after its had a value entered into it. In other words, if you change one of the parameters that go into duration calculation, like task type the duration will change - even though you typed it in and may not want it to.

Excerpt from the help file on the subject:
=================================
Enter task durations (duration: The total span of active working time that is required to complete a task. This is generally the amount of working time from the start to finish of a task, as defined by the project and resource calendar.) and indicate whether the durations are estimated or set.
=================================

I guess if you give your definitions for how "elapsed" duration differs from "standard working time" we can probably offer a better answer.

Also, what exactly are you trying to acheive with your routine? Maybe more info from you could prompt others to come up with the "right" solution.

Earl
Hello,
Is it possible to "read" in VBA if the Duration of a task is specified as
"elapsed" vs. standard working time duration ?

Thanks

Newbie
 
J

JackD

Earl,

Perhaps you are not aware, but you can enter a duration for a task using
elapsed time (edays for example) and it will calculate as if the task were
on a 24 hour 7 day calendar. This is useful for tasks such as concrete
curing etc. where elapsed duration is really what you want. It seemed to me
that the person asking the question was wondering how you distinguish tasks
entered with an elapsed duration from within VBA.

I'm not sure there is an explicit marker so I suggest checking to see if the
elapsed duration = the elapsed duration (not taking into account the
calendar).
--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Newbie,

Duration is by definition the elapsed time between the start and end
dates - in work days (or hours, minutes, weeks or months) depending on how
you choose to display it.
However, the duration field holds the number of work minutes, calculated
based on the selected task type, the amount of work and the resources
assigned to it. Again, dependent on the selected task type and other task
values.
Even though the field is primarily a data entry field it will calculate
(and recalculate) after its had a value entered into it. In other words, if
you change one of the parameters that go into duration calculation, like
task type the duration will change - even though you typed it in and may not
want it to.
Excerpt from the help file on the subject:
=================================
Enter task durations (duration: The total span of active working time that
is required to complete a task. This is generally the amount of working time
from the start to finish of a task, as defined by the project and resource
calendar.) and indicate whether the durations are estimated or set.
=================================

I guess if you give your definitions for how "elapsed" duration differs
from "standard working time" we can probably offer a better answer.
Also, what exactly are you trying to acheive with your routine? Maybe more
info from you could prompt others to come up with the "right" solution.
 
N

Newbie

Hello Jack,
You are right, you understood exactly my question. Thanks for your hint.
I already expected to do that, but i'm afraid that this "biased" test gives
a bad result if the task is suffering some splits.
NB : You know that it's not possible to test on the presence of an "ed" on
the right end of the Duration.

Newbie
 
G

Gérard Ducouret

Hello,
Try using the GetField method :
- ActiveCell.Task.Duration 'returns a number of minutes
- ActiveCell.Task.GetField(FieldID:=pjTaskDuration) 'returns the full
duration data

Gérard Ducouret
 
E

Earl Lewis

Jack and Newbie,

Thanks for the big heads-up on this. This is very cool. I wasn't aware this even existed. I've never seen it, used it or seen it documented anywhere. Is it documented? Anywhere? It's not in the help, not that I can see. How long has it been there? I can't wait to use it. Holy mackerel, I think my heads gonna explode! ;>)

And how stupid do I feel raving on about task types. Sorry Newbie! My apologies. And that nugget from Gerard looks like just the fix you need for your question.

I always like to say that you learn something new everyday, and sometimes you're really lucky and it'll be two things. I got my two for today! Thanks again.

Earl
Earl,

Perhaps you are not aware, but you can enter a duration for a task using
elapsed time (edays for example) and it will calculate as if the task were
on a 24 hour 7 day calendar. This is useful for tasks such as concrete
curing etc. where elapsed duration is really what you want. It seemed to me
that the person asking the question was wondering how you distinguish tasks
entered with an elapsed duration from within VBA.

I'm not sure there is an explicit marker so I suggest checking to see if the
elapsed duration = the elapsed duration (not taking into account the
calendar).
--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Newbie,

Duration is by definition the elapsed time between the start and end
dates - in work days (or hours, minutes, weeks or months) depending on how
you choose to display it.
However, the duration field holds the number of work minutes, calculated
based on the selected task type, the amount of work and the resources
assigned to it. Again, dependent on the selected task type and other task
values.
Even though the field is primarily a data entry field it will calculate
(and recalculate) after its had a value entered into it. In other words, if
you change one of the parameters that go into duration calculation, like
task type the duration will change - even though you typed it in and may not
want it to.
Excerpt from the help file on the subject:
=================================
Enter task durations (duration: The total span of active working time that
is required to complete a task. This is generally the amount of working time
from the start to finish of a task, as defined by the project and resource
calendar.) and indicate whether the durations are estimated or set.
=================================

I guess if you give your definitions for how "elapsed" duration differs
from "standard working time" we can probably offer a better answer.
Also, what exactly are you trying to acheive with your routine? Maybe more
info from you could prompt others to come up with the "right" solution.
 
J

JackD

Earl Lewis said:
Jack and Newbie,

Thanks for the big heads-up on this. This is very cool. I wasn't aware
this even existed. I've never seen it, used it or seen it
documented anywhere. Is it documented? Anywhere? It's not in the help, not
that I can see. How long has it been there?

I'm pretty sure it was there in Project98. Before that I can not remember. I
can't remember how I found out about it but I did somehow.

-Jack
 
E

Earl Lewis

Hey gang,

In response to Gerard's astute comment, here's a little routine that will test for elapsed durations. Hope it helps make up for my earlier rant.

Sub TestEDur()
Dim strMsg As String
Dim strDur as String
For Each Task In ActiveProject.Tasks
strDur = Task.GetField(pjTaskDuration)
If InStr(1, strDur, "e", vbTextCompare) Then
strMsg = strMsg & "Task " & Task.ID & ": duration:" & strDur & vbCrLf
End If
Next

If Len(strMsg) > 0 Then
MsgBox strMsg, vbOKOnly + vbInformation
Else
MsgBox "There were no elapsed durations found", vbOKOnly + vbInformation
End If

End Sub


Earl
Hello,
Try using the GetField method :
- ActiveCell.Task.Duration 'returns a number of minutes
- ActiveCell.Task.GetField(FieldID:=pjTaskDuration) 'returns the full
duration data

Gérard Ducouret
 
J

JackD

Earl,

Actually it still needs one thing.
Don't forget that "week" has an e in it.
Yes, you can set it to display in "weeks" by going to tools menu
/options/edit tab and setting the view options.
Here is a corrected version which looks for " e" instead of "e" - note the
space.
Not sure how it would work in a localized version, probably would break in
pig latin "eeksway".

Sub TestEDur()
Dim strMsg As String
Dim strDur As String
For Each Task In ActiveProject.Tasks
strDur = Task.GetField(pjTaskDuration)
If InStr(1, strDur, " e", vbTextCompare) Then
strMsg = strMsg & "Task " & Task.ID & ": duration:" & strDur &
vbCrLf
End If
Next

If Len(strMsg) > 0 Then
MsgBox strMsg, vbOKOnly + vbInformation
Else
MsgBox "There were no elapsed durations found", vbOKOnly +
vbInformation
End If

End Sub

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Hey gang,

In response to Gerard's astute comment, here's a little routine that will
test for elapsed durations. Hope it helps make up for my earlier rant.
 
E

Earl Lewis

Jack,

When I do elapsed weeks I get 5ewks, not 5eweeks. What do you see?

And I can imagine my routine would need some mods if it was moved to another language. Especially pig-latin. ;>)

Earl
Earl,

Actually it still needs one thing.
Don't forget that "week" has an e in it.
Yes, you can set it to display in "weeks" by going to tools menu
/options/edit tab and setting the view options.
Here is a corrected version which looks for " e" instead of "e" - note the
space.
Not sure how it would work in a localized version, probably would break in
pig latin "eeksway".

Sub TestEDur()
Dim strMsg As String
Dim strDur As String
For Each Task In ActiveProject.Tasks
strDur = Task.GetField(pjTaskDuration)
If InStr(1, strDur, " e", vbTextCompare) Then
strMsg = strMsg & "Task " & Task.ID & ": duration:" & strDur &
vbCrLf
End If
Next

If Len(strMsg) > 0 Then
MsgBox strMsg, vbOKOnly + vbInformation
Else
MsgBox "There were no elapsed durations found", vbOKOnly +
vbInformation
End If

End Sub

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Hey gang,

In response to Gerard's astute comment, here's a little routine that will
test for elapsed durations. Hope it helps make up for my earlier rant.
 
J

JackD

Do this.
Open the project. Go to tools menu / options / edit tab. In the box for
weeks set it to "weeks".
Now you will see "5 eweeks".

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Jack,

When I do elapsed weeks I get 5ewks, not 5eweeks. What do you see?

And I can imagine my routine would need some mods if it was moved to
another language. Especially pig-latin. ;>)
 
E

Earl Lewis

Jack,

Man, I'm racking up the new things learned today. I guess I knew that setting was there but never saw the need to mess with it. Good to know how if effects display - and little utilites like this one. Thanks again Jack!

Earl
Do this.
Open the project. Go to tools menu / options / edit tab. In the box for
weeks set it to "weeks".
Now you will see "5 eweeks".

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Earl Lewis said:
Jack,

When I do elapsed weeks I get 5ewks, not 5eweeks. What do you see?

And I can imagine my routine would need some mods if it was moved to
another language. Especially pig-latin. ;>)
 
G

Gérard Ducouret

Hi Jack, Hi Earl,
In French, "elapsed" is translated by "écoulé" which is represented by an
"é" : fortunately, this "é" is not confusing with any duration unit. So we
can test directly on this "é".
Earl, thanks for your enthusiastic feedback !

Gérard Ducouret


Earl Lewis said:
Jack,

Man, I'm racking up the new things learned today. I guess I knew that
setting was there but never saw the need to mess with it. Good to know how
if effects display - and little utilites like this one. Thanks again Jack!
 
E

Earl Lewis

Gerard (sorry, no accent ague on my PC),

I must be a real geek if I get that excited over a little "feature" like that. Oh well, you gotta find something to get excited about if you're stuck behind a keyboard all day.

Earl
Hi Jack, Hi Earl,
In French, "elapsed" is translated by "écoulé" which is represented by an
"é" : fortunately, this "é" is not confusing with any duration unit. So we
can test directly on this "é".
Earl, thanks for your enthusiastic feedback !

Gérard Ducouret


Earl Lewis said:
Jack,

Man, I'm racking up the new things learned today. I guess I knew that
setting was there but never saw the need to mess with it. Good to know how
if effects display - and little utilites like this one. Thanks again Jack!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top