|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Design pattern needed
I Have a Structure Table made of
Parent Child ChildQty SAA015 LD 1.2 SAA015 SAA017 3.2 SAA017 MD0122 2 SAA017 SAB019 3 SAB019 MA0143 2 The above is an example of a structure I create a recordset based on a parent key of SA015. So my Parent recordset consists of 2 records. I then need to loop round to obtain a total figure. So on the first record I simply read my table Labour table with the key LD and obtain details. I then need to perform a calculation on the record and add the values to temporary store. Then I go to my second record and I see that it is made up of another structure SAA017 I therefore need to read the structure table again to find out what the SAA017 record is made up of. The first time in, it’s made up of a Material Record MD0122 so I read values from this table and place it in a new temporary store. The second record of SAA017 is made up of Structure SAB019, again I have to read the structure table to find out what it comprises of this time it’s Material MA0143 so I now take my calculation of MA013 and with additional calculation make another with the MD0122 calculation (second temporary store) then this with my first temporary store and the LD record so that I end up with a single value for the original SAA Structure. As an easier example SAA010 LD 0.5 SAA010 MAA019 2.3 SAA010 MDE040 0.7 In this structure my recordset would have 3 records and I would loop 3 times calling either my labour or my material table for values and perform a calculation. It’s when a structure comprises of another structure that the problem starts. Structures can have an infinite number of structures within them. I need a design pattern to overcome this. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Design pattern needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|