![]() |
|
|
|||
|
way to test if task exists?
I'm looking for a way to see if any tasks remain once a filter is applied.
if there are tasks, i need to edit their constraints. if not, just keep going through the code (ideally it would create a picture saying "no tasks for this resource" but i realize that's probably not realistic.) The annoyance lies in that if there are no tasks and it tries to edit them, it ends up inserting an extra row. here are the lines of code. the extra row gets inserted after the "SetTaskField Field" command. Once i go back to "AllActive" there is now a new black row (a task). Anybody know how to get around this, besides filtering out all the blank tasks? 'Backfeeds unassigned tasks FilterApply Name:="Yes" SelectAll SetTaskField Field:="Constraint Type", Value:="As Late As Possible", AllSelectedTasks:=True FilterApply Name:="All Active" thanks! scott |
|
|||
|
Re: way to test if task exists?
Scott,
You are going about this the wrong way. What does your filter test for? Let me give you an example. Assume that the filter tests for tasks which have no resources assigned. the code would be sub theintern() dim t as task dim ts as tasks set ts = activeproject.tasks for each t in ts if not t is nothing then if not t.summary then if t.resources = "" then t.contstrainttype = pjALAP end if end if end if next t end sub Working with selections and fields the way you are doing is not very effective. You can see the problems you have run into. The above code works in the background no matter which view or filter is applied. I suggest you read through the articles on working with tasks that I have here: http://zo-d.com/blog/archives/programming.html -Jack Dahlgren "theintern" <theintern@discussions.microsoft.com> wrote in message news:A892CB39-6865-49EC-9646-80BA95333A67@microsoft.com... > I'm looking for a way to see if any tasks remain once a filter is applied. > if there are tasks, i need to edit their constraints. if not, just keep > going through the code (ideally it would create a picture saying "no tasks > for this resource" but i realize that's probably not realistic.) The > annoyance lies in that if there are no tasks and it tries to edit them, it > ends up inserting an extra row. here are the lines of code. the extra > row > gets inserted after the "SetTaskField Field" command. Once i go back to > "AllActive" there is now a new black row (a task). Anybody know how to > get > around this, besides filtering out all the blank tasks? > > 'Backfeeds unassigned tasks > FilterApply Name:="Yes" > SelectAll > SetTaskField Field:="Constraint Type", Value:="As Late As Possible", > AllSelectedTasks:=True > FilterApply Name:="All Active" > > thanks! > scott |
|
|||
|
Re: way to test if task exists?
The filter is for all tasks with a "Yes" in the resource initials column,
meaning that no resource has yet been assigned to them. i need to filter for these tasks, then change their constraint types to "As Late As Possible." But if there are no tasks with "Yes" in the resource initials, it ends up inserting a blank task. I'll read that link you sent and see if that helps at all. If what I've said here changes/clarifies anything, let me know. Thanks scott "Jack Dahlgren" wrote: > Scott, > > You are going about this the wrong way. > What does your filter test for? > Let me give you an example. > Assume that the filter tests for tasks which have no resources assigned. > > the code would be > > sub theintern() > dim t as task > dim ts as tasks > set ts = activeproject.tasks > for each t in ts > if not t is nothing then > if not t.summary then > if t.resources = "" then > t.contstrainttype = pjALAP > end if > end if > end if > next t > end sub > > Working with selections and fields the way you are doing is not very > effective. You can see the problems you have run into. > The above code works in the background no matter which view or filter is > applied. > > I suggest you read through the articles on working with tasks that I have > here: > http://zo-d.com/blog/archives/programming.html > > -Jack Dahlgren > > "theintern" <theintern@discussions.microsoft.com> wrote in message > news:A892CB39-6865-49EC-9646-80BA95333A67@microsoft.com... > > I'm looking for a way to see if any tasks remain once a filter is applied. > > if there are tasks, i need to edit their constraints. if not, just keep > > going through the code (ideally it would create a picture saying "no tasks > > for this resource" but i realize that's probably not realistic.) The > > annoyance lies in that if there are no tasks and it tries to edit them, it > > ends up inserting an extra row. here are the lines of code. the extra > > row > > gets inserted after the "SetTaskField Field" command. Once i go back to > > "AllActive" there is now a new black row (a task). Anybody know how to > > get > > around this, besides filtering out all the blank tasks? > > > > 'Backfeeds unassigned tasks > > FilterApply Name:="Yes" > > SelectAll > > SetTaskField Field:="Constraint Type", Value:="As Late As Possible", > > AllSelectedTasks:=True > > FilterApply Name:="All Active" > > > > thanks! > > scott > > > |
|
|||
|
Re: way to test if task exists?
Hi,
After Selectall : If not activeselection=0 then HTH -- Jan De Messemaeker Microsoft Project Most Valuable Professional +32 495 300 620 For availability check: http://users.online.be/prom-ade/Calendar.pdf "theintern" <theintern@discussions.microsoft.com> wrote in message news:23417DEF-30E6-46F8-9146-0CDFE0797768@microsoft.com... > The filter is for all tasks with a "Yes" in the resource initials column, > meaning that no resource has yet been assigned to them. i need to filter > for > these tasks, then change their constraint types to "As Late As Possible." > But if there are no tasks with "Yes" in the resource initials, it ends up > inserting a blank task. I'll read that link you sent and see if that > helps > at all. If what I've said here changes/clarifies anything, let me know. > > Thanks > scott > > "Jack Dahlgren" wrote: > >> Scott, >> >> You are going about this the wrong way. >> What does your filter test for? >> Let me give you an example. >> Assume that the filter tests for tasks which have no resources assigned. >> >> the code would be >> >> sub theintern() >> dim t as task >> dim ts as tasks >> set ts = activeproject.tasks >> for each t in ts >> if not t is nothing then >> if not t.summary then >> if t.resources = "" then >> t.contstrainttype = pjALAP >> end if >> end if >> end if >> next t >> end sub >> >> Working with selections and fields the way you are doing is not very >> effective. You can see the problems you have run into. >> The above code works in the background no matter which view or filter is >> applied. >> >> I suggest you read through the articles on working with tasks that I have >> here: >> http://zo-d.com/blog/archives/programming.html >> >> -Jack Dahlgren >> >> "theintern" <theintern@discussions.microsoft.com> wrote in message >> news:A892CB39-6865-49EC-9646-80BA95333A67@microsoft.com... >> > I'm looking for a way to see if any tasks remain once a filter is >> > applied. >> > if there are tasks, i need to edit their constraints. if not, just >> > keep >> > going through the code (ideally it would create a picture saying "no >> > tasks >> > for this resource" but i realize that's probably not realistic.) The >> > annoyance lies in that if there are no tasks and it tries to edit them, >> > it >> > ends up inserting an extra row. here are the lines of code. the extra >> > row >> > gets inserted after the "SetTaskField Field" command. Once i go back >> > to >> > "AllActive" there is now a new black row (a task). Anybody know how to >> > get >> > around this, besides filtering out all the blank tasks? >> > >> > 'Backfeeds unassigned tasks >> > FilterApply Name:="Yes" >> > SelectAll >> > SetTaskField Field:="Constraint Type", Value:="As Late As Possible", >> > AllSelectedTasks:=True >> > FilterApply Name:="All Active" >> > >> > thanks! >> > scott >> >> >> |
|
|||
|
Re: way to test if task exists?
Beautiful. Thanks so much!
"Jan De Messemaeker" wrote: > Hi, > After Selectall : > If not activeselection=0 then > HTH > -- > Jan De Messemaeker > Microsoft Project Most Valuable Professional > +32 495 300 620 > For availability check: > http://users.online.be/prom-ade/Calendar.pdf > "theintern" <theintern@discussions.microsoft.com> wrote in message > news:23417DEF-30E6-46F8-9146-0CDFE0797768@microsoft.com... > > The filter is for all tasks with a "Yes" in the resource initials column, > > meaning that no resource has yet been assigned to them. i need to filter > > for > > these tasks, then change their constraint types to "As Late As Possible." > > But if there are no tasks with "Yes" in the resource initials, it ends up > > inserting a blank task. I'll read that link you sent and see if that > > helps > > at all. If what I've said here changes/clarifies anything, let me know. > > > > Thanks > > scott > > > > "Jack Dahlgren" wrote: > > > >> Scott, > >> > >> You are going about this the wrong way. > >> What does your filter test for? > >> Let me give you an example. > >> Assume that the filter tests for tasks which have no resources assigned. > >> > >> the code would be > >> > >> sub theintern() > >> dim t as task > >> dim ts as tasks > >> set ts = activeproject.tasks > >> for each t in ts > >> if not t is nothing then > >> if not t.summary then > >> if t.resources = "" then > >> t.contstrainttype = pjALAP > >> end if > >> end if > >> end if > >> next t > >> end sub > >> > >> Working with selections and fields the way you are doing is not very > >> effective. You can see the problems you have run into. > >> The above code works in the background no matter which view or filter is > >> applied. > >> > >> I suggest you read through the articles on working with tasks that I have > >> here: > >> http://zo-d.com/blog/archives/programming.html > >> > >> -Jack Dahlgren > >> > >> "theintern" <theintern@discussions.microsoft.com> wrote in message > >> news:A892CB39-6865-49EC-9646-80BA95333A67@microsoft.com... > >> > I'm looking for a way to see if any tasks remain once a filter is > >> > applied. > >> > if there are tasks, i need to edit their constraints. if not, just > >> > keep > >> > going through the code (ideally it would create a picture saying "no > >> > tasks > >> > for this resource" but i realize that's probably not realistic.) The > >> > annoyance lies in that if there are no tasks and it tries to edit them, > >> > it > >> > ends up inserting an extra row. here are the lines of code. the extra > >> > row > >> > gets inserted after the "SetTaskField Field" command. Once i go back > >> > to > >> > "AllActive" there is now a new black row (a task). Anybody know how to > >> > get > >> > around this, besides filtering out all the blank tasks? > >> > > >> > 'Backfeeds unassigned tasks > >> > FilterApply Name:="Yes" > >> > SelectAll > >> > SetTaskField Field:="Constraint Type", Value:="As Late As Possible", > >> > AllSelectedTasks:=True > >> > FilterApply Name:="All Active" > >> > > >> > thanks! > >> > scott > >> > >> > >> > > > |
|
|||
|
Re: way to test if task exists?
Hi ,
Next time, try posting on the microsoft.public.project.developer newsgroup. Please see FAQ Item: 24. Project Newsgroups. FAQs, companion products and other useful Project information can be seen at this web address: http://project.mvps.org/faqs.htm Mike Glen Project MVP theintern wrote: > Beautiful. Thanks so much! > > "Jan De Messemaeker" wrote: > >> Hi, >> After Selectall : >> If not activeselection=0 then >> HTH >> -- >> Jan De Messemaeker >> Microsoft Project Most Valuable Professional >> +32 495 300 620 >> For availability check: >> http://users.online.be/prom-ade/Calendar.pdf >> "theintern" <theintern@discussions.microsoft.com> wrote in message >> news:23417DEF-30E6-46F8-9146-0CDFE0797768@microsoft.com... >>> The filter is for all tasks with a "Yes" in the resource initials >>> column, meaning that no resource has yet been assigned to them. i >>> need to filter for >>> these tasks, then change their constraint types to "As Late As >>> Possible." But if there are no tasks with "Yes" in the resource >>> initials, it ends up inserting a blank task. I'll read that link >>> you sent and see if that helps >>> at all. If what I've said here changes/clarifies anything, let me >>> know. >>> >>> Thanks >>> scott >>> >>> "Jack Dahlgren" wrote: >>> >>>> Scott, >>>> >>>> You are going about this the wrong way. >>>> What does your filter test for? >>>> Let me give you an example. >>>> Assume that the filter tests for tasks which have no resources >>>> assigned. >>>> >>>> the code would be >>>> >>>> sub theintern() >>>> dim t as task >>>> dim ts as tasks >>>> set ts = activeproject.tasks >>>> for each t in ts >>>> if not t is nothing then >>>> if not t.summary then >>>> if t.resources = "" then >>>> t.contstrainttype = pjALAP >>>> end if >>>> end if >>>> end if >>>> next t >>>> end sub >>>> >>>> Working with selections and fields the way you are doing is not >>>> very effective. You can see the problems you have run into. >>>> The above code works in the background no matter which view or >>>> filter is applied. >>>> >>>> I suggest you read through the articles on working with tasks that >>>> I have here: >>>> http://zo-d.com/blog/archives/programming.html >>>> >>>> -Jack Dahlgren >>>> >>>> "theintern" <theintern@discussions.microsoft.com> wrote in message >>>> news:A892CB39-6865-49EC-9646-80BA95333A67@microsoft.com... >>>>> I'm looking for a way to see if any tasks remain once a filter is >>>>> applied. >>>>> if there are tasks, i need to edit their constraints. if not, >>>>> just keep >>>>> going through the code (ideally it would create a picture saying >>>>> "no tasks >>>>> for this resource" but i realize that's probably not realistic.) >>>>> The annoyance lies in that if there are no tasks and it tries to >>>>> edit them, it >>>>> ends up inserting an extra row. here are the lines of code. the >>>>> extra row >>>>> gets inserted after the "SetTaskField Field" command. Once i go >>>>> back to >>>>> "AllActive" there is now a new black row (a task). Anybody know >>>>> how to get >>>>> around this, besides filtering out all the blank tasks? >>>>> >>>>> 'Backfeeds unassigned tasks >>>>> FilterApply Name:="Yes" >>>>> SelectAll >>>>> SetTaskField Field:="Constraint Type", Value:="As Late As >>>>> Possible", AllSelectedTasks:=True >>>>> FilterApply Name:="All Active" >>>>> >>>>> thanks! >>>>> scott |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|