Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

I hope somebody may be able to help me with my problem.

In a nutshell I am required to develop a Pivot / Cross Table Style Data Input Form.

The description above might be enough for a response but if not i have tried to explain the problem in detail below.

The Tables in question are:

Table 1 = ValveItem(ValveId, Qty, etc....)
Table 2 = ExtraRequirement(ExtraRequirementID, Qty, IsKeyRequirement, etc....)
Table 3 = KeyRequirement_Valve_ExtraItems(ValveID_FK, ExtraRequirementID_FK, Qty)

A ValveItem is a line item within a contract and contains detail about the Valve and Qty of valves ordered.

ExtraRequirements are additional items that MAY be related to the ValveItem. For example special testing, Delivery conditions etc. ExtraRequirements have a QTY.

Of all the ExtraRequirements for that CONTRACT.. SOME MAY be flagged as a KeyRequirement.
i.e ExtraItem.isKeyRequirement = True

ALL ValveItems within a Contract have the KeyRequirement associated with it. A Qty value for the KeyRequirement must be entered even if it is Zero (0).

ExtraRequirement QTY and KeyRequirement QTY may not be the same value. (Not ideal but nothing i can do about that :) )

A Pivot / Cross Table Style Data Input Form is required to list all Valves as a ROWS against the ExtraItem(KeyRequirements) as a columns.

The quantities QTY required for the KeyRequirements is the Input Data.

I have tried to illustrate this below.

___________¦ ExtraItem (KeyRequirement)
ValveItem__¦ ExtraItem1 ¦ ExtraItem2 ¦ ExtraItem3 ¦

ValveItem1_¦_____5______¦_____1______¦_____5______¦

ValveItem2_¦_____3______¦_____3______¦_____1______¦

ValveItem3_¦_____5______¦_____5______¦_____5______¦

The KeyRequirment_Valve_ExtraItems link table stores the unqiue Qty's for the KeyRequirement.


I hope i have been able to explain the problem in enough detail but not without confusing the hell out anybody :)

I look forward to your responses.

Thank you all for your time in advance

Best Regards

Alex
Posted
Updated 18-Jun-13 4:09am
v2

1 solution

take a look on this article, my help

Simple Way To Use Pivot In SQL Query
 
Share this answer
 
Comments
djapb 20-Jun-13 11:44am    
Hello and thank you for your response, but I have to be able to update to data within the pivot table.
I understand how to read / report the information. But i cannot figure out how to detail this in a FORM where the user can update the values.

Thank you again for your help and if you have any further recommendations i will follow them up.

Thanks Alex

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900