-
December 12th, 2012, 05:08 PM
#1
Data structure for new/old items codes
Hello,
I have a 2 tables
items codes: new item code, old item code
items quantities: item code, month, items quantity
There are several cases:
Case 1:
Z is the newer code, X is older code
X -> y -> Z
Case 2:
X -> Z
Y-> Z
Z is the newer code, X & Y are older code
I need to recalculate quantities table.
Case 1:
replace Z quantity by X quantity + Y quantity + Z quantity
replace Y quantity by X quantity + Y quantity
Before update:
x 10
Y 20
Z 30
After update:
x 10
Y 10+20=30
Z 10+20+30=60
Case 2:
replace Z quantity by X quantity + Y quantity + Z quantity
Before update:
x 10
Y 20
Z 30
After update:
x 10
Y 20
Z 10+20+30=60
How can I create a data structure to store 'items codes' with something like pointers (new code to old code)
so I will be able to find all the previous items codes of a selected item code ?
Thank you for your help
-
December 12th, 2012, 07:58 PM
#2
Re: Data structure for new/old items codes
You probably want a hash table, also know as dictionary or associative array.
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
December 13th, 2012, 01:46 AM
#3
Re: Data structure for new/old items codes
Hello,
Thank you for your answer.
Does hash table will be useful in this situation ?
a-> b-> c -> d -> e
f -> g -> h-> e
i -> e
I mean E is the current item code which replaces D,H,I.
A-I are old names in 3 chains.
I need to save for each letter (name) 12 numbers (demand for months).
In order to calculate E demand I need to sum A-I demands and add it to E demand (Edemand=Ademand+Bdemand+Cdemnd+...+Idemand)
What do you think ?
Thank you for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|