Generating multiple records from a single record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to generate multiple records from a single record such that the sum of
each of the multiple records equals a value in the single record. I.e. I have
a record that states that I need to manufacture 100 units of product x. I
wish to create 25 production orders each to manufacture a quantity of 4.

I can do this by maintaining a table with one number field and values:
1;2;2;3;3;3;4;4;4;4 etc. but this is a bit messy. Is there any slicker way to
do this without resorting to coding?
 
samwardill said:
I want to generate multiple records from a single record such that the sum
of
each of the multiple records equals a value in the single record. I.e. I
have
a record that states that I need to manufacture 100 units of product x. I
wish to create 25 production orders each to manufacture a quantity of 4.

I can do this by maintaining a table with one number field and values:
1;2;2;3;3;3;4;4;4;4 etc. but this is a bit messy. Is there any slicker way
to
do this without resorting to coding?

Is a production order always going to be in units of 4? If not, where does
this 4 come from?
 
The only thing I can think of, is what I think you already suggested.

Have a table that just contains a single column containing the numbers
1-9999

Then somthing like:

Insert into NewTable (Quantity)
(
Select UnitQty from
<suitable sub-query to get single row containing qty required and unitqty
from other tables>,
NumbersTable
Where NumbersTable.Number <= QtyRequired/UnitQuantity
)

Hmmm, that's not quite right, I haven't got time to work it out properly
just now, but hopefully you get the gist?

Regards,

Chris.
 
Back
Top