|Subject||Re: [firebird-support] Invoice Detail: Design / Normalization|
When printing any document the normalisation issue comes up.
Personally I use a TMemo and write two lines to it. The first line containing the field names - enclosed in " separated by ,. And the second line containing the corresponding field values - once again enclosed in " - all strings - separated by ,. Then I Memo1.SaveToFile () with a extension .csv. This technique works great for running ms word mailmerge. The fields are all those that appear once on every invoice.
For detail lines that are repeated - you need to automate word using tables. This is off topic. I can help you with this if you email me.
On 23 Sep 2014 22:48, "shg_sistemas@... [firebird-support]" <firstname.lastname@example.org> wrote:
Hello, I've posted this question in the "general" but the moderator told me it's a "support" question. So here I go again!
It's a design / normalization question: How to save Invoice detail correctly?
Each line on the invoice detail has its FK pointing to the Article's ID, but sometimes the user needs to modify or add some text to the article description just for that invoice. Or sometimes he/she needs to insert a "free" line (pointing to no article at all) just filling the description.
So my "big" doubt is: Is this a case for "denormalization" ? Should I add a "description" field to the invoice detail (and 90% of the time having exactly the same description of the article's table!!)
Or should I have the "description" field in a separate table. In this case I don't imagine how to update that table, as the user enters the data in a DBGrid (I work with Delphi / IBDac)
I hope I'm clear with my question!