Parent Task

J

John Mamani

Hi,

I have a table with the following info: Work Orders and tasks, I need to
setup the parent task: task 20's parent is task 10, etc, etc, etc

id, wo, task, parent
1, 2345-1, 10, null
2, 2345-1, 20, null
3, 2345-1, 30, null
4, 5432-1, 10, null
5, 5432-1, 20, null

How do I convert it to................

id, wo, task, parent
1, 2345-1, 10, 1
2, 2345-1, 20, 1
3, 2345-1, 30, 2
4, 5432-1, 10, 1
5, 5432-1, 20, 4

Thank you all,

Bre-x
 
J

John Mamani

It should be (sorry for the typo)

id, wo, task, parent
1, 2345-1, 10, 1
2, 2345-1, 20, 1
3, 2345-1, 30, 2
4, 5432-1, 10, 4
5, 5432-1, 20, 4
6, 5432-1, 30, 5
 
J

John Spencer

I have no idea. I can't see the logic you are using to set the Parent from
what you have posted.

If there is not something in the records that would allow you to set the
parent, then the only way I can think of is to type the parent into the
field.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
S

scubadiver

You haven't provide enough information.

John Mamani said:
It should be (sorry for the typo)

id, wo, task, parent
1, 2345-1, 10, 1
2, 2345-1, 20, 1
3, 2345-1, 30, 2
4, 5432-1, 10, 4
5, 5432-1, 20, 4
6, 5432-1, 30, 5
 
N

NetworkTrade

Please reply to this if you are following this thread still - and I'll supply
further detail. In general this is the sql statement:

SELECT t.id, t.wo, t.task,
IIF(isnull(t2.id), t.id, (IIF(t.wo = t2.wo, t2.id, t.id)) ) as parent
FROM t left join t t2 ON t.id-1=t2.id;

If you are not familiar with sql statements I can explain further how to
insert your actual terms into this statement.
 
J

John Mamani

A Work Order (2345-1) is made of a number of "Tasks". A WO can have from 1
task to Many

When the Work Order goes to the shop the machine operator will work on Task
10, then
the WO will go to another machine operator to work on Task 20, and so on.
You can not start task 20, until task 10 is finish.

Then, when task Number 10 is set to 100% completed, I will automatically set
the start date/time of task number 20 to match the finish date of Task
Number 10

To acomplish that we need to know that Task 20
 
N

NetworkTrade

I really don't need the business rationale.....

I looked at the starting table data - and what you wanted for table data....

Table logic is:

if current WO is same as previous record - then current Parent is current
record's ID-1

If current WO is not the same as previous record - then current Parent is
current ID

The sql statement I supplied works....it assumes you have no Parent value;
just ID, WO, and Task....it will supply the correct Parent value
 

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