Adam,

I am not sure where you are wanting this total. There may be other methods to do this, but I prefer to do this calculation in a query. I use separate queries for reports and forms so a change in one does not affect the other. First, you need to create a query, if you have never created a query, then there is a learning curve you need to go through to create one. You could start by using the wizard to create the query and then save it and quit it. Then you can edit it in "Design Mode". Once in the Design mode, you can verify that your table is in the upper frame and your table field names are in the lower frame with the "Visible" block checked. This will get you what you have now and you can build on it. You need to add a field to the bottom frame with your formula in the "Field" block. For your example, it would look likeĀ  "(fee1+fee2)" (no quotes). You probably don't need the parens either, but it is safe. Then, in theĀ  "Alias" block of this new column, you need to add your new field name. In your example, it would be "Total" , again no quotes. Make sure the "Visible" block is checked or the total result will not be passed out of the query. If you already have a "Total" field in your table, then you need to have another, unique, name.

Then you need to have your form attach itself to the query rather than the table. You do this by opening the form in "Edit" mode and selecting the "Form" icon. At this time, you should have a popup called "Form Properties". Select the "Data" tab and in the "Content type" list select "Query". Then select your new query in the "Content" list. Then you can add the new "Total" field to your form. Doing so in a report is similar.

This is just a short description. You should be familiar with LO queries to do this. All of this may be documented well by now. So, read up on it if you want to create a query.

Note: One should never have calculated fields in a database. It wastes space.

Note also that I am using Mariadb (MySQL). If you are using the LO bundled database server, then this may be different.

HTH.

Girvin



On 10/11/18 11:39 AM, Adam Fenn wrote:
I have three currency fields - 'Fee1', 'Fee2' and 'Total'.  How do I add fee1 
and fee2 together and put the result automatically into the Total field?

TIA
Adam.

--
To unsubscribe e-mail to: [email protected]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Reply via email to