Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
other
informationbridge
office.intranets
office.misc
office.setup
office.xml
officeupdate
onenote
photodraw.discussion
powerpoint
producer
proj.standard&server
project
project.developer
project.pro_and_serve
project.server
project.vba
project2000
publisher
publisher.prepress
publisher.programming
publisher.webdesign
visio
visio.createshapes
visio.database.modeling
visio.dev.diagrams
visio.dev.shapesheet
visio.dev.vba
visio.dev.vc
visio.developer
visio.general
visio.installation
visio.printing
visio.software.modeling
visio.troubleshoot
  
 
date: Wed, 2 Jul 2008 22:08:00 -0700,    group: microsoft.public.project.developer        back       


Code for Using Lag   
Hi,

the lag property doesn't seem to work when you use percentages in the 
predecessor or successor fields.  Can someone tell me what the code is to 
read the lead or lag of a task?

I would like to take the finish date for a task, and then add the lag of the 
successor task to the successor(s) so that I can compute date for the 
successor(s) task relative this predecessor's finish date using the lag data.

If relative numbers (e.g., 50%) are used in the lag field, the lag property 
does not seem to compute that number well.  Example.,4FF+ 50% = 5???

Any help is appreicated.

Spiro Theopoulos.
date: Wed, 2 Jul 2008 22:08:00 -0700   author:   ST

Re: Code for Using Lag   
Lag is always a percentage of the predecessor task.
If you put the lag on the dependency, then project will automatically 
calculate all the successor dates.
Look at the taskdependency object of how to read lead or lag.
To set a dependency with a percent lag you need to use the correct lagtype.
In project 2007 the lagtype for positive percentage lag is 19 so set that 
and then the percentage (as in integer ie: 50% would be 50)

-Jack Dahlgren



"ST"  wrote in message 
news:CAAAD247-6E62-4763-B3C2-166DA4267656@microsoft.com...
> Hi,
>
> the lag property doesn't seem to work when you use percentages in the
> predecessor or successor fields.  Can someone tell me what the code is to
> read the lead or lag of a task?
>
> I would like to take the finish date for a task, and then add the lag of 
> the
> successor task to the successor(s) so that I can compute date for the
> successor(s) task relative this predecessor's finish date using the lag 
> data.
>
> If relative numbers (e.g., 50%) are used in the lag field, the lag 
> property
> does not seem to compute that number well.  Example.,4FF+ 50% = 5???
>
> Any help is appreicated.
>
> Spiro Theopoulos.
>
date: Wed, 2 Jul 2008 22:47:17 -0700   author:   Jack Dahlgren

Re: Code for Using Lag   
Hi Jack,

Thanks for you reply... Please see my comments marked "[Spiro]" embedded 
below in your recent response:


"Jack Dahlgren" wrote:

> Lag is always a percentage of the predecessor task.

[Spiro] Always?  Or, did you mean when I use % with the dependency instead 
of a absolute number? 

> If you put the lag on the dependency, then project will automatically 
> calculate all the successor dates.

[Spiro] I'm most interested in reading the lag(s) of a tasks and then 
computing the the date, and then checking against the successors' Start to 
see if it is the same or greater.  If I can read the and determine the 
duration from the lag property, I would then like to pass this duration as a 
parameter "Application.DateAdd()" and/ or "Application.DateDifference()".  I 
don't mind having to parse the result I get back from the Lag property, but I 
can not make sense out of it.

[Spiro] Below I have examples of what VBA returns on the following examples 
with the statement: 
"ActiveCell.Task.SuccessorTasks.Item(1).TaskDependencies(1).Lag"

[Spiro]...
When reading "3FS-53%", Lag = 5
How does one get to the remaing 3% in 53%.  And where is the negative?

When reading 3FS+53%, Lag = 5.  Again, no change in the result between a 
positive and negative relative number.

When reading 4FS+2.5 days, Lag = 1200

When reading 6FS-2.6 hrs, Lag = 0
I get '0' when in fact I have entered -2.6 hrs.


> Look at the taskdependency object of how to read lead or lag.
[Spiro]  What I have as a description on the Lag Property from the Object 
Browser and MSDN is very vague..."The duration of lag time between linked 
tasks. To specify lead time between tasks, use a negative value. String 
values default to days unless otherwise specified. Non-string values are 
interpreted as minutes. Read/write Variant".

[Spiro] Jack, do you have a link that you know of for this that you can send 
me?  


> To set a dependency with a percent lag you need to use the correct lagtype.
[Spiro] I'm OK with this.  Again, I'm most interested in getting as a result 
is the duration difference that would correspond  to the predeccessor's 
current finish and successor's potential start.

> In project 2007 the lagtype for positive percentage lag is 19 so set that 
> and then the percentage (as in integer ie: 50% would be 50)
> 
[Spiro] I don't know where you find this reference "19" for when you use 
precentage.  I'll I have as a description for "Type" is:  "TaskDependency 
object: Returns or sets the task dependency type. Can be one of the following 
PjTaskLinkType constants: pjFinishToFinish, pjFinishToStart, pjStartToFinish, 
or pjStartToStart. Read/write Long."

Again, any reference that you may have 

> -Jack Dahlgren
> 
> 
> 
> "ST"  wrote in message 
> news:CAAAD247-6E62-4763-B3C2-166DA4267656@microsoft.com...
> > Hi,
> >
> > the lag property doesn't seem to work when you use percentages in the
> > predecessor or successor fields.  Can someone tell me what the code is to
> > read the lead or lag of a task?
> >
> > I would like to take the finish date for a task, and then add the lag of 
> > the
> > successor task to the successor(s) so that I can compute date for the
> > successor(s) task relative this predecessor's finish date using the lag 
> > data.
> >
> > If relative numbers (e.g., 50%) are used in the lag field, the lag 
> > property
> > does not seem to compute that number well.  Example.,4FF+ 50% = 5???
> >
> > Any help is appreicated.
> >
> > Spiro Theopoulos.
> > 
> 
> 
>
date: Thu, 3 Jul 2008 08:11:01 -0700   author:   ST

Re: Code for Using Lag   
"ST" wrote:

> > Lag is always a percentage of the predecessor task.
> 
> [Spiro] Always?  Or, did you mean when I use % with the dependency instead 
> of a absolute number? 

When lag is a percentage it always refers to the predecessor task. It is 
never a percentage of the successor.


> > If you put the lag on the dependency, then project will automatically 
> > calculate all the successor dates.
> 
> [Spiro] I'm most interested in reading the lag(s) of a tasks and then 
> computing the the date, and then checking against the successors' Start to 
> see if it is the same or greater.  If I can read the and determine the 
> duration from the lag property, I would then like to pass this duration as a 
> parameter "Application.DateAdd()" and/ or "Application.DateDifference()".  I 
> don't mind having to parse the result I get back from the Lag property, but I 
> can not make sense out of it.

Sounds like you are trying to find the driving task...
If you are using Project 2007 you can look at the StartDriver property 
instead of trying to work this out.

> [Spiro] Below I have examples of what VBA returns on the following examples 
> with the statement: 
> "ActiveCell.Task.SuccessorTasks.Item(1).TaskDependencies(1).Lag"
> 
> [Spiro]...
> When reading "3FS-53%", Lag = 5
> How does one get to the remaing 3% in 53%.  And where is the negative?
> 
> When reading 3FS+53%, Lag = 5.  Again, no change in the result between a 
> positive and negative relative number.
> 
> When reading 4FS+2.5 days, Lag = 1200
> 
> When reading 6FS-2.6 hrs, Lag = 0
> I get '0' when in fact I have entered -2.6 hrs.
> 
> 
> > Look at the taskdependency object of how to read lead or lag.
> [Spiro]  What I have as a description on the Lag Property from the Object 
> Browser and MSDN is very vague..."The duration of lag time between linked 
> tasks. To specify lead time between tasks, use a negative value. String 
> values default to days unless otherwise specified. Non-string values are 
> interpreted as minutes. Read/write Variant".
> 
> [Spiro] Jack, do you have a link that you know of for this that you can send 
> me?  

I think that the documentation for lagtype is incorrect. It looks to be cut 
and pasted from the lag property. Lagtype is new for 2007 and I think the 
reason is exactly what you are running into - without it there is no way of 
determining what the value returned means.

> 
> > To set a dependency with a percent lag you need to use the correct lagtype.
> [Spiro] I'm OK with this.  Again, I'm most interested in getting as a result 
> is the duration difference that would correspond  to the predeccessor's 
> current finish and successor's potential start.
> 
> > In project 2007 the lagtype for positive percentage lag is 19 so set that 
> > and then the percentage (as in integer ie: 50% would be 50)
> > 
> [Spiro] I don't know where you find this reference "19" for when you use 
> precentage.  I'll I have as a description for "Type" is:  "TaskDependency 
> object: Returns or sets the task dependency type. Can be one of the following 
> PjTaskLinkType constants: pjFinishToFinish, pjFinishToStart, pjStartToFinish, 
> or pjStartToStart. Read/write Long."

The way I determined it was to run some test code.
Build a small project file with a number of different dependencies from the 
first task to other tasks, then run this macro:

Sub deps()
Dim alldeps As TaskDependencies
Dim d As TaskDependency
Set alldeps = ActiveProject.Tasks(1).TaskDependencies
For Each d In alldeps
MsgBox d.To.Name & " Lag: " & d.Lag & " lagtype: " & d.LagType & " type: " & 
d.Type
Next d
End Sub

I tried on the copy of Proj2003 I have available here and find that the data 
returned is insufficient (no lagtype property) but it does return useful info 
in Project 2007.

-Jack Dahlgren
date: Thu, 3 Jul 2008 08:41:03 -0700   author:   Jack Dahlgren

Re: Code for Using Lag   
Again, See commenst embedded below... and thanks for you previous reply Jack. 
 It helped me answer what I needed to know.


/Spiro

"Jack Dahlgren" wrote:

> 
> 
> "ST" wrote:
> 
> > > Lag is always a percentage of the predecessor task.
> > 
> > [Spiro] Always?  Or, did you mean when I use % with the dependency instead 
> > of a absolute number? 
> 
> When lag is a percentage it always refers to the predecessor task. It is 
> never a percentage of the successor.

[Spiro] Yes, of course... thanks for the clarification

> 
> 
> > > If you put the lag on the dependency, then project will automatically 
> > > calculate all the successor dates.
> > 
> > [Spiro] I'm most interested in reading the lag(s) of a tasks and then 
> > computing the the date, and then checking against the successors' Start to 
> > see if it is the same or greater.  If I can read the and determine the 
> > duration from the lag property, I would then like to pass this duration as a 
> > parameter "Application.DateAdd()" and/ or "Application.DateDifference()".  I 
> > don't mind having to parse the result I get back from the Lag property, but I 
> > can not make sense out of it.
> 
> Sounds like you are trying to find the driving task...
> If you are using Project 2007 you can look at the StartDriver property 
> instead of trying to work this out.
> 

[Spiro] I'm using 2003.  Not looking for driving task but close, I had 
something else in mind.  

> > [Spiro] Below I have examples of what VBA returns on the following examples 
> > with the statement: 
> > "ActiveCell.Task.SuccessorTasks.Item(1).TaskDependencies(1).Lag"
> > 
> > [Spiro]...
> > When reading "3FS-53%", Lag = 5
> > How does one get to the remaing 3% in 53%.  And where is the negative?
> > 
> > When reading 3FS+53%, Lag = 5.  Again, no change in the result between a 
> > positive and negative relative number.
> > 
> > When reading 4FS+2.5 days, Lag = 1200
> > 
> > When reading 6FS-2.6 hrs, Lag = 0
> > I get '0' when in fact I have entered -2.6 hrs.
> > 
> > 
> > > Look at the taskdependency object of how to read lead or lag.
> > [Spiro]  What I have as a description on the Lag Property from the Object 
> > Browser and MSDN is very vague..."The duration of lag time between linked 
> > tasks. To specify lead time between tasks, use a negative value. String 
> > values default to days unless otherwise specified. Non-string values are 
> > interpreted as minutes. Read/write Variant".
> > 
> > [Spiro] Jack, do you have a link that you know of for this that you can send 
> > me?  
> 
> I think that the documentation for lagtype is incorrect. It looks to be cut 
> and pasted from the lag property. Lagtype is new for 2007 and I think the 
> reason is exactly what you are running into - without it there is no way of 
> determining what the value returned means.
> 

[Spiro] Too bad.  I could have used it.


> > 
> > > To set a dependency with a percent lag you need to use the correct lagtype.
> > [Spiro] I'm OK with this.  Again, I'm most interested in getting as a result 
> > is the duration difference that would correspond  to the predeccessor's 
> > current finish and successor's potential start.
> > 
> > > In project 2007 the lagtype for positive percentage lag is 19 so set that 
> > > and then the percentage (as in integer ie: 50% would be 50)
> > > 
> > [Spiro] I don't know where you find this reference "19" for when you use 
> > precentage.  I'll I have as a description for "Type" is:  "TaskDependency 
> > object: Returns or sets the task dependency type. Can be one of the following 
> > PjTaskLinkType constants: pjFinishToFinish, pjFinishToStart, pjStartToFinish, 
> > or pjStartToStart. Read/write Long."
> 
> The way I determined it was to run some test code.
> Build a small project file with a number of different dependencies from the 
> first task to other tasks, then run this macro:
> 
> Sub deps()
> Dim alldeps As TaskDependencies
> Dim d As TaskDependency
> Set alldeps = ActiveProject.Tasks(1).TaskDependencies
> For Each d In alldeps
> MsgBox d.To.Name & " Lag: " & d.Lag & " lagtype: " & d.LagType & " type: " & 
> d.Type
> Next d
> End Sub
> 
> I tried on the copy of Proj2003 I have available here and find that the data 
> returned is insufficient (no lagtype property) but it does return useful info 
> in Project 2007.


[Spiro] Well, you answered my question.  I guess I can not do this in 2003.

> 
> -Jack Dahlgren
date: Thu, 3 Jul 2008 11:58:02 -0700   author:   ST

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us