gringope24
Member
- Local time
- Today, 18:11
- Joined
- Apr 1, 2020
- Messages
- 51
I made some changes in database design. I want to discuss it with you because I still missing the idea how to solve my problem.
Please fallow a steps of possible scenario of user:
1. Create a statement which always at the beginning is Offer (StatementType).
2. Input Groups, then input Items and other information. No problem.
3. Access generate the Offer Letter and I am sending it to Customers.
3. Hopefully, one of the Customers want to buy everything from my Offer.
4. So I change a flag (Change StatementType to Order), input data in tblOrderData. Everything is fine!
but
5. Suddenly customer call me that he wants to make changes in Order, for example: modify quantity of specific Item, add some Item in different Group and delete one of the Groups with its Items Completely. I can modify all of this things, but I want to also keep the history what was offered in the beginning!
To handle the issue from point 5, I thought about solution presented below.
I make pairs in tblStatementGroups and in tblGroupsItems and give them specific code to know what is their history. For example when Group and Item go through the whole process without any changes then it has code 'Offered and Ordered'. But when I change the quantity of specific Items it technically means that I create a new record in tblItems by duplicating Item and change only quantity, next step is to relate new record with accurate Group in tblGroupsItems, now it has code 'Order Only'. The original record in tblGroupsItems need to change its code 'Offered and Ordered' to 'Offer Only'. This situation is presented in below example:
There is a Group where GroupID=1 and 3 x Items where ItemID=5,6,7:
Group 1, Item 5, Offered and Ordered
Group 1, Item 6, Offered and Ordered
Group 1, Item 7, Offered and Ordered
I change qty in Item 5, so now it is tblGroupsItems we see:
Group 1, Item 5, Offer Only (change code)
Group 1, Item 6, Offered and Ordered
Group 1, Item 7, Offered and Ordered
Group 1, Item 8, Order Only (new record)
After some time I need to change data in GroupID=1, so I create GroupID=2, and it also make fallowing changes in tblGroupsItems:
Group 1, Item 5, Offer Only (change code)
Group 1, Item 6, Offer Only (change code)
Group 1, Item 7, Offer Only (change code)
Group 2, Item 8, Order Only (change only GroupId, because Item was already created as Order Only)
Group 2, Item 6, Order Only (new record)
Group 2, Item 7, Order Only (new record)
The disadvantage that I see here is also that both tblGroups and tblItems need to have code fields. If not, how Access will now if it is allowed to change data within a record (if code is 'Offer Only' or 'Order Only') or new record needs to be created (if code is 'Offered and Ordered').
Now I think that maybe code field shouldn't exist in tblGroupsItems and it should be present in tblItems and tblGroups. What do you think? Query could help me to filter which items and Groups are dedicated for 'Offer Only', 'Order Only' or 'Offered and Ordered'.
I am not sure if my solution is optimal. Maybe you have different view and opinion to this design, to ensure its good performance.
Please fallow a steps of possible scenario of user:
1. Create a statement which always at the beginning is Offer (StatementType).
2. Input Groups, then input Items and other information. No problem.
3. Access generate the Offer Letter and I am sending it to Customers.
3. Hopefully, one of the Customers want to buy everything from my Offer.
4. So I change a flag (Change StatementType to Order), input data in tblOrderData. Everything is fine!
but
5. Suddenly customer call me that he wants to make changes in Order, for example: modify quantity of specific Item, add some Item in different Group and delete one of the Groups with its Items Completely. I can modify all of this things, but I want to also keep the history what was offered in the beginning!
To handle the issue from point 5, I thought about solution presented below.
I make pairs in tblStatementGroups and in tblGroupsItems and give them specific code to know what is their history. For example when Group and Item go through the whole process without any changes then it has code 'Offered and Ordered'. But when I change the quantity of specific Items it technically means that I create a new record in tblItems by duplicating Item and change only quantity, next step is to relate new record with accurate Group in tblGroupsItems, now it has code 'Order Only'. The original record in tblGroupsItems need to change its code 'Offered and Ordered' to 'Offer Only'. This situation is presented in below example:
There is a Group where GroupID=1 and 3 x Items where ItemID=5,6,7:
Group 1, Item 5, Offered and Ordered
Group 1, Item 6, Offered and Ordered
Group 1, Item 7, Offered and Ordered
I change qty in Item 5, so now it is tblGroupsItems we see:
Group 1, Item 5, Offer Only (change code)
Group 1, Item 6, Offered and Ordered
Group 1, Item 7, Offered and Ordered
Group 1, Item 8, Order Only (new record)
After some time I need to change data in GroupID=1, so I create GroupID=2, and it also make fallowing changes in tblGroupsItems:
Group 1, Item 5, Offer Only (change code)
Group 1, Item 6, Offer Only (change code)
Group 1, Item 7, Offer Only (change code)
Group 2, Item 8, Order Only (change only GroupId, because Item was already created as Order Only)
Group 2, Item 6, Order Only (new record)
Group 2, Item 7, Order Only (new record)
The disadvantage that I see here is also that both tblGroups and tblItems need to have code fields. If not, how Access will now if it is allowed to change data within a record (if code is 'Offer Only' or 'Order Only') or new record needs to be created (if code is 'Offered and Ordered').
Now I think that maybe code field shouldn't exist in tblGroupsItems and it should be present in tblItems and tblGroups. What do you think? Query could help me to filter which items and Groups are dedicated for 'Offer Only', 'Order Only' or 'Offered and Ordered'.
I am not sure if my solution is optimal. Maybe you have different view and opinion to this design, to ensure its good performance.