I would like to know if may I do a calculated field in Base, without a query.
Sometimes, you won’t have to deal with queries, because you want an immediate reply for a simple calculated query.
Let’s imagine I have a table, with several fields… and I have a field called…
and another field called
finally, another field called
this field (RESULT) would deduce the porcentaje of discount entered in the discount field, so the formula to calculate this field (RESULT) would be:
RESULT = AMOUNT - (( AMOUNT * DISCOUNT ) / 100)
That is in plain words, I multiply the amount per the discount, then I divide it by 100, and then, I deduce this result from the AMOUNT.
if I enter $100 in the AMOUNT field, and I enter 20 in the DISCOUNT field… I would like to have the calculated field in result, showing 80. (Because a 20% of discount from 100 dollars, are 20 dollars, so 100 dollars - 20 dollars = 80 dollars)
Of course, if I have to perform a query for every single entry in my table, I would get crazy, so I need a way, in which I can obtain a calculated field
How may I do this, without running a query?
I think default BASE engine (HDBSQL) have not computed FIELDS.
But you can simplify a bit the expression:
RESULT = AMOUNT * (1-DISCOUNT)
And I do not understand what do you mean with “if I have to perform a query for every single entry in my table”.
You can set parameters in the query, see the documentation:
for Queries chapter.
What I mean is I want the calculations be performed in real time whilst I am introducing the data in the table, if I vinculate a query with the table, I have to finish all the entries in my table and then, go to the query, run the query, and then, get the calculated field back in my table
I don’t want that
I want to introduce the data in my table, and get automatically the calculated field.