Transfer value from a calculated field to a database field in form

Hello,

I have an invoicing form that adds the item prices from my item table and generates a total. “Total” is a calculated field but I would like it to populate a total field in the invoice table of my database. Is there a way through a macro or any other potions? Any assistance will be greatly appreciated.

This question is cross posted here → Looking to output a calculated field in a LibreOffice Base form into a database field

Please indicate links on each post stating the other post. This may save duplicate efforts. There is nothing wrong with cross posting. However, it is considered very rude not to note this.

Hi,

The question is not clear, assuming you have the Total calculation in a query, use the query as the data source for the form and or reports.

Updating a Total field in the table can be done via SQL and macro, however it is not good practice as calculations are performed on the fly and available in both reports and forms, therefor there is no need to store in table.

Do you have any examples of macros that could do this? I just want to copy and paste from one calculated field to a database field in the same form.

Edit: I’m just looking to copy from one field to another. When I attempt to record a macro and preform this action, the dialogue to save the macro never appears so I’m assuming it’s not registering the operation.

Macros in base are not recorded but written. Macros require a fair bit of a learning curve. Your post at Stack Overflow mentions MySQL, different flavour of HSQL, so sorry can not assist you.
However would recommend to read up on the basics of LibreOffice base. There are plenty of resources.

@gkick Are you sure macros can’t be recorded in Base? My assumption was never that they could not be recorded, just that the specific operation I was preforming could not be recorded. I have found several resources (here is one example: https://www.youtube.com/watch?v=EAm7RgzWRhM&ab_channel=ComputingandICTinaNutshell) that have demonstrated recording macros in Base. I understand the complexities of writing macros by hand so that’s why I was looking to avoid this if possible. Either way though, it appears that recording macros is possible, I’m just surprised that copying and pasting isn’t included in that functionality.