Merging rows into columns in VB.NET using a Dataset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Orbie
    New Member
    • Nov 2009
    • 7

    Merging rows into columns in VB.NET using a Dataset

    Hi All,
    I'm looking for help with coding some logic to loop through a Dataset i've created called "InputData" . The Dataset contains price info for certain products in various different stores and is sorted by ID and then Store ID:

    Code:
    ID	Deparmtent	Section	Commodity	Description	Store ID	Expected Price	Actual Price
    1	BAKERY	CAKES	CAKES	CHOCOLATE CHIP MUFFIN'S	1	1.99	2.09
    1	BAKERY	CAKES	CAKES	CHOCOLATE CHIP MUFFIN'S	2	2.29	1.89
    8	GROCERY	FRUIT AND VEG	ONIONS 	LOOSE PACKED ONIONS	1	0.49	0.69
    8	GROCERY	FRUIT AND VEG	ONIONS 	LOOSE PACKED ONIONS	3	0.29	0.37

    I would like to merge the above so each product appears on a single line:


    Code:
    ID	Deparmtent	Section	Commodity	Description	Store ID	Expected Price	Actual Price	Store ID	Expected Price	Actual Price
    1	BAKERY	CAKES	CAKES	CHOCOLATE CHIP MUFFIN'S	1	1.99	2.09	2	2.29	1.89
    8	GROCERY	FRUIT AND VEG	ONIONS 	LOOSE PACKED ONIONS	1	0.49	0.69	3	0.29	0.37
    The code would need to be dynamic in that it will handle multiple stores and not just the two i've used in the example above.

    Any help would be appreciated.

    Thanks

    Orbie.
Working...