Gary Williams
02-26-2008, 12:24 PM
Hi All,
Apoligies if the solution should be obvious to me, I suspect that this is a very common task in relational databases, but my mind has gone blank on this problem.(I suspect I'm getting past it :( ).
I have created a simple ASP/MySQL workflow application. When a new job is entered via a form, one of two departments is selected by the user on the form. The user then answers the questions relevant to the chosen department. Although the jobs when carried out by each department are similar, they each have specific (but different) questions to be answered. To do this elegantly (?), I created three tables:
1. Job Sheet
This contains all the common details, ie, job/record id, username, etc.
2. Department 1
This contains all the answers to the questions specific to Department 1.
3. Department 2
This contains all the answers to the questions specific to Department 2.
The first field in 'Job Sheet' is an autogenerated job/record id. In tables 'Department 1' and 'Department 2', I have a field to store the record id generated in 'Job Sheet' to link 'Job Sheet' to either 'Department 1' or 'Department 2' as necessary for each job requested. That is, the data for any single job is stored across two tables.
Here's the thing. When a user completes the form for a new job and chooses, say, Department1 and saves the data, 'Job Sheet' will autogenerate a new job/record id plus save the data to be stored in 'Job Sheet'. Now, how do I get this new job/record id value stored in table 'Department 1' to link the data so I have a reliable record?
Regards
Gary
Apoligies if the solution should be obvious to me, I suspect that this is a very common task in relational databases, but my mind has gone blank on this problem.(I suspect I'm getting past it :( ).
I have created a simple ASP/MySQL workflow application. When a new job is entered via a form, one of two departments is selected by the user on the form. The user then answers the questions relevant to the chosen department. Although the jobs when carried out by each department are similar, they each have specific (but different) questions to be answered. To do this elegantly (?), I created three tables:
1. Job Sheet
This contains all the common details, ie, job/record id, username, etc.
2. Department 1
This contains all the answers to the questions specific to Department 1.
3. Department 2
This contains all the answers to the questions specific to Department 2.
The first field in 'Job Sheet' is an autogenerated job/record id. In tables 'Department 1' and 'Department 2', I have a field to store the record id generated in 'Job Sheet' to link 'Job Sheet' to either 'Department 1' or 'Department 2' as necessary for each job requested. That is, the data for any single job is stored across two tables.
Here's the thing. When a user completes the form for a new job and chooses, say, Department1 and saves the data, 'Job Sheet' will autogenerate a new job/record id plus save the data to be stored in 'Job Sheet'. Now, how do I get this new job/record id value stored in table 'Department 1' to link the data so I have a reliable record?
Regards
Gary