Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Sorting objects in a dictionary into corresponding Pairs...

Sorting objects in a dictionary into corresponding Pairs...

Scheduled Pinned Locked Moved C#
databasealgorithmshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    roman_s
    wrote on last edited by
    #1

    So here is my dilemma, rather then describe it I will show you it. Let say we take back a certain amount of records records from the DB Called Inventory Count and they have a corresponding number attached to them indicating if they are an opening Count (1) or a closing count (2) Date-Product-Quantity-Opening/Closing 1. 1/1/2010, Ice Cream Cones, 10, 1 2. 1/1/2010, Bananas, 8, 1 3. 1/1/2010, Chocolate Bars, 9, 1 4. 2/1/2010, Ice Cream Cones, 5, 2 5. 2/1/2010, Bananas, 4, 2 6. 2/1/2010, Chocolate Bars, 3, 2 7. 4/1/2010, Ice Cream Cones, 12, 1 8. 4/1/2010, Bananas, 8, 1 9. 4/1/2010, Chocolate Bars, 9, 1 10. 5/1/2010, Ice Cream Cones, 1, 2 11. 5/1/2010, Bananas, 2, 2 12. 5/1/2010, Chocolate Bars, 3, 2 I need to build a dictionary that will take the first group (Openings = 1) and do the subtraction of quantity for closing(Closing 2), This will make up Session 1, Session 2 will be the next corresponding groups of Opening = 1 - Closing = 2 Thanks for the help in advance, hopefully this is understandable

    R H 2 Replies Last reply
    0
    • R roman_s

      So here is my dilemma, rather then describe it I will show you it. Let say we take back a certain amount of records records from the DB Called Inventory Count and they have a corresponding number attached to them indicating if they are an opening Count (1) or a closing count (2) Date-Product-Quantity-Opening/Closing 1. 1/1/2010, Ice Cream Cones, 10, 1 2. 1/1/2010, Bananas, 8, 1 3. 1/1/2010, Chocolate Bars, 9, 1 4. 2/1/2010, Ice Cream Cones, 5, 2 5. 2/1/2010, Bananas, 4, 2 6. 2/1/2010, Chocolate Bars, 3, 2 7. 4/1/2010, Ice Cream Cones, 12, 1 8. 4/1/2010, Bananas, 8, 1 9. 4/1/2010, Chocolate Bars, 9, 1 10. 5/1/2010, Ice Cream Cones, 1, 2 11. 5/1/2010, Bananas, 2, 2 12. 5/1/2010, Chocolate Bars, 3, 2 I need to build a dictionary that will take the first group (Openings = 1) and do the subtraction of quantity for closing(Closing 2), This will make up Session 1, Session 2 will be the next corresponding groups of Opening = 1 - Closing = 2 Thanks for the help in advance, hopefully this is understandable

      R Offline
      R Offline
      roman_s
      wrote on last edited by
      #2

      Ive used sorteddictionary to now group the different dates..

      1 Reply Last reply
      0
      • R roman_s

        So here is my dilemma, rather then describe it I will show you it. Let say we take back a certain amount of records records from the DB Called Inventory Count and they have a corresponding number attached to them indicating if they are an opening Count (1) or a closing count (2) Date-Product-Quantity-Opening/Closing 1. 1/1/2010, Ice Cream Cones, 10, 1 2. 1/1/2010, Bananas, 8, 1 3. 1/1/2010, Chocolate Bars, 9, 1 4. 2/1/2010, Ice Cream Cones, 5, 2 5. 2/1/2010, Bananas, 4, 2 6. 2/1/2010, Chocolate Bars, 3, 2 7. 4/1/2010, Ice Cream Cones, 12, 1 8. 4/1/2010, Bananas, 8, 1 9. 4/1/2010, Chocolate Bars, 9, 1 10. 5/1/2010, Ice Cream Cones, 1, 2 11. 5/1/2010, Bananas, 2, 2 12. 5/1/2010, Chocolate Bars, 3, 2 I need to build a dictionary that will take the first group (Openings = 1) and do the subtraction of quantity for closing(Closing 2), This will make up Session 1, Session 2 will be the next corresponding groups of Opening = 1 - Closing = 2 Thanks for the help in advance, hopefully this is understandable

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #3

        You say that you want to build a dictionary. Are you under instruction to use a Dictionary? It seems, from what you have posted that this should all be done in the database.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups