Chasing the tail
Posted in 1995
Hi all, I have got one here that is making me wonder: I am trying to squeeze information out of a commercial accounting package, Bill of Materials Header and Detail. So far so good, the catch is that the Detail table is self referencing: components go to make up components etc until you get the finished part. Header ( header_key char(20), other stuff about the finished part.. ) Detail ( detail_key char(20), component_key char(20) <-references a sub_component's detail_key ) The detail table holds costing information which I need to sum to get a cost per unit for each part in the header table. Easy? I tried building a reference table, with each detail component listed against what part in the header it ultimately goes to make up. The mathematics of permutations and combinations made me fall off the edge of the disk. I tried recursively following the detail_key, component_key, detail_key... trail for each finished part and had a program that took days to run. Anybody come across this sort of problem before? bright ideas? Am I missing the obvious? All the best, Pete.