Hi All,
This has been doing my head it and i expect its not as hard as i'm making it out to be.
I'm creating a WorkFlow Management app which is made up of Workflows, Task and Subtasks.
All i want to do loop through all Tasks in the Workflow. If a task in a Workflow has any child tasks, iterate them and do the same again ie, if child tasks exists, iterate, and so on.
Its really no different to a directory structure
C DRIVE
Folder 1
Folder 1-a
Folder 1-b
Folder 1-b-i
Folder 1-b-ii
.
.
Folder 2
So what i'm looking to do is
Workflow: Drive to Shop
Task 1: Get in car
Sub task 1a: Get keys out of pocket
etc.
etc
Task 2: Drive to Shop
.
.
My Tasks Table looks like this:
TASKID | NAME | PARENT TASK
1 | Drive to Shop | None
2 | Task 1: Get in Car | 1
3 | Sub Task 1a: Keys | 2
4 | Task 2: Drive to shop | 1
How the bloody hell do i set up the for loops? Do i
1. create a method that takes the Task as a parameter
2. If child tasks exist, call the loop through all tasks
3. Call the same method again with the current task as the param?
hope this make sense
thanks
Clay