Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Master Detail Best Practice
Sun, Sep 8 2013 11:37 PMPermanent Link

Michael Riley

ZilchWorks

Avatar

I'm looking for feedback on best practice when it comes to a unique
Master/Detail scenario.

For the sake of this discussion let's assume we are using the following
two tables from Delphi's DBDemos: vendors and parts. There is a 1:M
relationship between these tables. 1 vendor may have many parts.

Now further suppose you intended to play out several different what if
scenarios with this data. However, you only wanted to work with one
specific vendor and that vendor's parts data at a time. When you are
done playing with this data you may or may not decide to keep the
altered data for this particular vendor.

How would you go about working with this data?

I was thinking about creating two "work" tables one called WrkVendor
and the other called wrkParts. I could then copy the one vendor's data
into these work tables. I could play around with the work tables until
I was satified with the changes at which point I could replace the data
using the data from the "work" tables. Or simply do nothing if the
results determined that the original data is the best fit.

Does this sound like a logical approach?


--
Michael Riley
GySgt USMC (Ret)
www.zilchworks.com
Mon, Sep 9 2013 3:23 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael


It depends on whet you're going to be doing in your what ifs. What you're suggesting is a very nice and totally isolated approach. If you create multiple wrk* tables you can look at multiple scenarios at the same time and compare then.

Just thinking - lets assume that all you're doing is playing with order quantities, and the master database hold some sort of volume pricing model and what you're trying to do is see what mix of products from what vendors give the best overall price. With that scenario you'd possibly be better off creating a table holding scenario code, supplier, part number, quantity ordered, order cost and use that with appropriate JOINs to provide information.

Roy Lambert
Mon, Sep 9 2013 5:45 PMPermanent Link

Michael Riley

ZilchWorks

Avatar

Roy Lambert wrote:

> It depends on whet you're going to be doing in your what ifs. What
> you're suggesting is a very nice and totally isolated approach. If
> you create multiple wrk* tables you can look at multiple scenarios at
> the same time and compare then.

Roy,

Thanks for confirming what I am thinking. It's kinda like what happens
when people (myself included) start playing around with an Excel
spreadsheet. If things get way out of control you can always exit
without saving and start over.

If you are updating the live data the only way to undo stuff is to keep
track of all the changes and then revert back. It seems much easier to
use a set of work tables.


--
Michael Riley
GySgt USMC (Ret)
www.zilchworks.com
Tue, Sep 10 2013 4:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael

The only extension I'd suggest is to use a set of directories - one per variation. Then you can use the same table names and code throughout just altering where the data lives.


Roy Lambert
Image