Simple Multiplication in Base

OK, I am probably thinking way to hard and searching. But I can’t seem to find an answer. I am trying to Get a Total from two Amounts via Multiplication. I am very new to Base. I have read that SELECT"A" + “B” method, But no idea where to input that. Any help would be appreciated or links, I just can’t seem to find a proper solution. Thank you much.

Using Libre Office Base V 5.3.6.1 x64

Hello, Need some further clarification. Where are the two amounts coming from? Table fields? Controls? Where is the result going to? Table field? Control? Is this a result of a Query? Please be clear on what you are trying to accomplish & what you have.

That is hard, because Not sure. I have a a Client Order List that is a simple design. 6 slots for items, quantity, price and total. I am trying to multiply the Quantity and price to get the total. I can use the data from both the Table and a Quarry. Sorry for the late reply.

if anything i could possibly send you the odb file.

Basic DB design - don’t store information which can be generated from other fields. If you need this figure later on, it can be generated as in the sample provided. Did you look at it?

It blocked the Macros, not sure how to reenable them

The macro only applies to the CalcFields form. The QueryMultiply form should work without a problem.

BTW - For macro enabling, from menu Tools->Options then under LibreOffice->Security select Macro Security button. On next dialog, select Medium. Click OK, OK & close & reopen .odb. When prompted, select Enable macros for the document.

The Formula for the answer was confusing, I wont lie. But after a little more research I finally Figured it out. So between you answers and advice and another forum post I was able to figure it out. Thank you so much for your time and dealing with my lack of common sense haha

Not sure if you are aware but LO documentation is located here.

One last question, I am using the QueryMultiply to do this. I have it written where my Total 1 table/query was at. I replaced with “Quantity 1”*“Price 1” in that column. It works once the Record is saved. But the “Total” on the Form does not save to the Table. How could I do that? if possible?

As stated a couple of comments ago, that is bad practice. If you insist on that, it needs to be done using a macro. Before updating the record (an Event) the field is calculated, moved into the proper spot & then the record is allowed to be updated. You really should review the docs. On same page is Planning and Designing your Database and many samples. You question reveals the need for multiple tables with relationships in order to reduce errors & redundancy.

Very well, thank you so much for your time. Will start running through them once I have a little more free time. Again thank you.

If you want to view a sample .odb where this is done see my answer in this post.

Hello,

While waiting for a reply I put a sample together. There are two forms: QueryMultiply and CalcFields.

QueryMultiply uses a simply query as it data source:

SELECT "Name", "Amount1", "Percent1", "Amount1" * "Percent1" AS "CalcTotal", "ID" FROM "Table1"

And uses that to display the result. Of course the result is only available after the record is entered.

CalcFields uses a macro to get the result of the amounts entered in the Numeric fields.

Sample: SQLselect1.odb

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).