473,471 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need help setting up table structure for ordering by unit.

ajhayes
9 New Member
I posted a question here last week about an ordering database I'm trying to set up, and got some excellent help. So I'm hoping some of you might be able to get me on the right track with another question I've got on the same project.

Here's some general info on what I've done so far (For the record, I'm quite a novice at this.):

The database I'm setting up is for a small electric utility company to submit orders to the inventory warehouse for the parts that will be needed to build each project. The user enters the work request number (that comes from an unrelated work order system), and then can enter any number of materials orders for that project. Right now, the item number and quantity is entered by the user. I have a table that is imported from an excel spreadsheet from the inventory warehouse that has all of the item numbers and descriptions, and when the user enters the item number, it populates the description on the form. There is a query based on the current order number, and a report based on this query which can be submitted to the warehouse. All of this is working beautifully and it's doing exactly what we need... except now I've been requested to add a variation on this and that's where I need assistance.

When we are going to build a new powerline, each pole has a poletop configuration classification, or "unit number". They would like to be able to have the option to order by unit rather than having to enter each individual item specifically. For example, a C1 unit would have one crossarm, 3 insulators, and 3 pins; where a C2 unit would have two crossarms, 6 insulators, and 6 pins. Ultimately I need to have an order form that would show all of the individual components and required quantities to submit to the warehouse. So if they entered a quantity of five C1's, I'd need the report to list 5 crossarms, 15 insulators, and 15 pins.

I hope I'm explaining this question well enough. I didn't want to get too bogged down in the electrical terminology. Any suggestions in general on how to set this up? At this point, I'm just looking for some general suggestions on table/query structure.

Thanks so much,

April
Feb 23 '09 #1
15 2255
ChipR
1,287 Recognized Expert Top Contributor
The question to ask here is whether you want to be able to order by unit only, or also by individual item number mixed together.
Do you need to record the units ordered, or can you just use them to quickly enter orders, and save only the item totals?

It seems like either way you will need a table with:

UnitNumber - text, PK
CrossArmCount - integer
InsulatorCount - integer
PinCount - integer
OtherPartCount - integer
etc. for all parts
Feb 23 '09 #2
FishVal
2,653 Recognized Expert Specialist
Hi, ChipR.

The table could be "more normalized". ... IMHO

Kind regards,
Fish
Feb 23 '09 #3
ajhayes
9 New Member
They are okay with having the option of "order by part number" where all items within that order are by part number and then a separate option of "order by unit" where all items within that order are done by unit number. As long as the two different orders can still be linked back to the project. For instance, the guy who does the metering portion may want to order his stuff by order number, where the guys who build the line would want to order by unit.
Feb 23 '09 #4
ajhayes
9 New Member
These are my initial thoughts:

Table: tbl_unit_items
Fields:
Item Number
Unit Number
Qty Per Unit

Table: tbl_units_ordered
Fields:
Order Number (auto number)
Unit Number
Qty of Units

Then I thought I would set up a query with the two tables and then multiply the qty of units times the qty per unit for each item in the unit.

Is this even close?
Feb 23 '09 #5
FishVal
2,653 Recognized Expert Specialist
Looks perfect in a case if unit items collection will not be modified once defined.
Feb 23 '09 #6
ChipR
1,287 Recognized Expert Top Contributor
Sounds like that should work, and I think that's what Fish meant by "more normalized."
It seems the obvious solutions like to evade me late in the day.
Feb 23 '09 #7
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hmm, your requirement is a fairly tricky one to implement in a fully-general way. If at all possible try to keep table designs general enough to cope with other assembly groupings, not just one type, which perhaps is the disadvantage of Chip's suggestion. The table structure suggested is not fully normalised - which is OK if you can trade the disadvantages that lack of normalisation may bring for the simpler implementation that it allows.

In a generalised solution, what you are implementing can be either a higher-level grouped assembly - in which case you need to have another table with a many-1 relationship to reflect the grouping - or a self-reflexive one where a part can be a member of another part using a 'comprises' 1-many relationship on the same table.

Either way, dealing with such a grouping complicates selection procedures, presenting users with parts but also with assemblies comprising of parts - sounds simple but is far from simple to implement.

PS hadn't seen Fish's post and the subsequent replies when I drafted this one!

-Stewart
Feb 23 '09 #8
ajhayes
9 New Member
Are you saying as long as the group of items that make up a unit don't change? I can't really see any reason why they would change, but I suppose there's the possibility that they might want to change to a different brand of insulator or something like that in the future, which would be assigned a new part number when it came into our warehouse.
Feb 23 '09 #9
ChipR
1,287 Recognized Expert Top Contributor
I would definitely advise against trying to treat a unit as a part comprised of other parts. You can use a query to sum the unit's parts with other parts of the order, it's just going to be tricky, like Stewart says.
Feb 23 '09 #10
nico5038
3,080 Recognized Expert Specialist
This is the so-called classic Bill of Materials problem.
Check http://en.wikipedia.org/wiki/Bill_of_materials for the general description.

I would advise to use the selected item to record the "sub items" as a recipe so you always have a reference to the "construction" at the moment of ordering. Just in case someone changes the construction of the item after ordering.

Nic;o)
Feb 23 '09 #11
OldBirdman
675 Contributor
My warehouse stocks 3 items, Insulators, Poles, and Crossarms. ALL orders are for units. But a unit is composed of items, from 1 to many. The tables are:
Expand|Select|Wrap|Line Numbers
  1. Table1=Orders
  2. Order# Unit Qty  Comment
  3.    1         14   2   Pole Assembly
  4.    1         21  14  Crossarm
  5.    2         21   1   Crossarm
  6. Table2=items in units
  7. Unit# Item# Qty
  8.    14    6187  1    
  9.    14    1442  2
  10.    14    1741  6
  11.    21    1442  1
  12.    37    6187  1
  13.    72    1442  1
  14. Table3=item list
  15. Item#  Desc 
  16.  1442   Crossarm
  17.  1741   Insulator (Glass)
  18.  6187   Pole 60'
Warehouse gets:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.[Order#], Table2.[Item#], [Table1].[Qty]*[Table2].[Qty] AS Quantity, Table3.Desc
  2. FROM (Table1 INNER JOIN Table2 ON Table1.[Unit#] = Table2.[Unit#]) INNER JOIN Table3 ON Table2.[Item#] = Table3.[Item#]
  3. ORDER BY Table1.[Order#];
Feb 23 '09 #12
FishVal
2,653 Recognized Expert Specialist
Actually, [tbl_units_ordered] should not be linked neither to [Units] nor to [Items] if particular item model/supplier/price is expected to change in time.
Feb 24 '09 #13
OldBirdman
675 Contributor
My point here was only that by ordering in Units, not Items, for everything, the tables & queries were quite practical. I didn't try to collect rows of the query into total lines, apply prices, or consider how the distribution system works.
By creating a Units table, and considering everything as units, the problem became fairly simple. Actual implimentation would need to track costs, shipping schedules, urgency (restore electricty after storm, etc.) For those Units comprised of a single Item, these could be added to the Units table using UNION, whenever needed.
I just disagreed with:
I would definitely advise against trying to treat a unit as a part comprised of other parts
your requirement is a fairly tricky one to implement in a fully-general way.
Looks perfect in a case if unit items collection will not be modified once defined
Feb 24 '09 #14
ChipR
1,287 Recognized Expert Top Contributor
@Stewart Ross Inverness
I was actually talking about a part comprised of other parts, and only parts. Having everything in units comprised of parts is a great idea, and quite different.
Feb 24 '09 #15
NeoPa
32,556 Recognized Expert Moderator MVP
Hi April.

I would say the first thing to consider is clarifying in your head, before you go any further, exactly how you'd like this to work.
  1. Does it want to be entered and stored as a composite item rather than as a list of parts?
  2. Does the operator want to enter a part OR an item from the same control? Or would you want a separate process for entering the composite items?
With something which is obviously more complicated than was anticipated, it helps enormously to tie these issues down before proceeding more deeply into the issue. It enables you to ignore many branches of your decision tree.

Good luck anyway.
Feb 24 '09 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Philipp Lenssen | last post by:
I have a site that runs in strict mode in IE6, and IE is making <td>s for simple two-digit numbers really wide. So I want to restrict it (and right-align it) by using <td class="number"> and...
0
by: Reza Nabi | last post by:
Dear All: Banckgroud: I have a datagrid which lives inside a repeater. Which is working fine. What i need is to dyanamically set the column width of the grid (which lieves inside the repeater)....
3
by: Hadley Willan | last post by:
Hi, I was wondering if it's possible to order the result set by some of the set contained in an IN clause. For example. SELECT * FROM v_fol_unit_pub_utmpt WHERE folder_folder_object = 100120...
3
by: Sigmathaar | last post by:
Hi, I'm need some advice about lists and vectors. I'm doing a program who needs to have sequential access of a non ordered unit of objects whose size decreases almost each time the sequence is...
4
by: Brie_Manakul | last post by:
I need to set up an if else to show different weather scripts based on the city selection they choose. Any help on this would be great. Thanks! <%@ page language="java" import="java.util.*,...
7
by: balasam | last post by:
Dear friend, I am having Linux platform.I am declaring the array of structure in one file and how can access the values of the array of structure in another file. Using " extern " ,to extern...
1
by: Lance | last post by:
Hi all, Last week a reply from Tom Shelton helped me with declaring a Structure containing an array of a priviously defined structure like so : ///// Public Structure GM_ProjAttrValue_t...
1
by: yawnmoth | last post by:
I have two tables on the following page: http://www.frostjedi.com/terra/scripts/demo/tables.html I'm trying to make the top one look like the bottom in using only CSS. In FireFox, what I...
4
by: Alvin SIU | last post by:
Hi all, I have 6 tables inside a MS Access 2003 mdb file. I want to convert them as DB2 version -8 tables in AIX 5.2. I have exported them as 6 XML files. The XML files look fine. Each...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.