Despite that I have used global fields a lot lately, it was mainly in one specific type of use (filtering through relationship). I still am confused about other uses such as using them to create data. Here is my current problem.
- I do not want the client to have to modify a hard coded tax rate;
- the tax rate may change from one year to another but the past quotations need to continue bearing the tax that was in effect when the quote was created;
- it must be possible to set the tax based on each individual product.
Here is what I have done so far:
- Each product has a check box for each of the taxes that may be applied;
- Each Estimate has a fed tax rate field and a prov tax rate field
- In the Estimate Lines table, each item has a IsFedTax and IsProvTax fields that look up the product as well as a AmountForFedTax and AmountForProvTax fields auto enter that multiply the LineTotal by the bolean value to return the amount that must be added to the Fed tax tally and the Prov tax tally.
- In the Estimate table, the Grand tax total Fed and Grand tax total Prov fields are calculations fields that multiply their respective tally's sum by the appropriate tax rate.
Since the taxes rates used to calculate the Estimate need to be indexed I have them hard coded in number type fields, option auto-enter data (tax rate).
What I want to achieve, is for the client to go to the layout Info about My Company and set it there whenever he needs to change it. I know it is likely going to be only once a year. However, since I don't get the principle I need to learn how to do this properly.
I have tried a few strategies and none of them worked. I would really appreciate to know why it does not work, what it is that I did not understand that caused my logic to be flawed. to simplify, I will only discuss one of the taxes.
Strategy 1- I created a gTaxFed in the Table Info on My Company and FedTaxRate in the Table Estimate is set to auto-enter based on calculation (=InfoOnMyCompany::gTaxFed). When creating a new estimate, the tax rate field would get set automatically based on the gTaxFed content. Which is awesome. BUT. Everytime the application is closed, the Field resets to nothing. So if you don't think of writing it again at next opening, well it doesn't get entered when you create a new estimate. Initializing it as a variable at OnFirstWindowOpen defeats the purpose: I don't want to have to go in the back end to set this number.
Strategy 2 - I made a TO of InfoOnMyCompany table which I called Tax Rates, created gTaxFed and TaxFedCurrent. TaxFedCurrent being the indexed input field. gTaxFed is a calculated field taking its value from TaxFedCurrent and I set the Estimates::TaxFedRate indexed Field to auto enter based on calculation (= InfoOnMyCompany::gTaxFed). Nothing shows up in the field TaxFedRate when creating a new Estimate record. I tried checking the box allow records to be created in this table based on this relationship, to no avail.
Else - I just tried all sorts of combos of the above without any success other than getting myself and my file completely confused!!!
Here are the graph, relationship etc.: