Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Probably an easy question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00501861
Message ID:
00502222
Views:
17
>Hello,
>
>I am brand new to VFP, so this question is probably a very easy one. I am using VFP 6.0 with Stonefield and MMF.
>
>I have a large database containing many large tables. One of these tables contains several thousand customer orders, another contains a listing of all the possible products a customer can order, as well as all of the components needed to build each product. For example - Product A contains components 1, 3, 6, and 7; Product B contains componenents 1, 2, and 3.
>
>I need help writing a method that would pull all products containing a particular component and replace that component with a new one for all existing and future orders. For example - Using the data above, if component 2 was to be replaced with component 4, any future orders for product B would contain components 1, 3, and 4.
>
>I apologize if this seems real easy to you, but I am just starting out in VFP and could use any help you VFP Gurus could offer me!
>
>-Justin

First the design: If the components of a product can change midstream, it sounds like you have a problem (assuming you want to know the right components for past shipments!). Either you're going to have to have a table to store the components sold along with the products sold, or create some sort of start_use, end_use fields on the components, or -- probably the best solution -- simply make a "new" product record every time it changes so an old sales order will link to an "old" version on the product with a differn't primarykey and the correct component makeup at the time.

After all, if the components that make a product change, you really have a new product. You'll just need some way to copy a product and its child records into a new record when it's changed.

As for your problem here, then all you need to do is, when the product is modified, check for current or future orders and change those order's primarykeys to the new one. Notifying or asking the user as needed.

Hope that's all clear.
Previous
Reply
Map
View

Click here to load this message in the networking platform