edit-ebot: unnecessary call for help removed. Shouting shut off.
How to use a computed field in a query ?
2019-03-06_161326.png
edit-ebot: unnecessary call for help removed. Shouting shut off.
How to use a computed field in a query ?
2019-03-06_161326.png
Doesn’t that need to be CAST(("БО_2_КАТ" * 0.25) AS DECIMAL(5,2)) AS "Bo+0,25"
(note last AS
before column alias)?
And specifically in this case, I don’t see a value of using calculated field in the “dffgd” calculation over simple CAST(("БО_2_КАТ" * 1.25) AS DECIMAL(5,2))
.
Hello,
This is a bug when using Firebird. The problem is the result does not have the decimal inserted. This can be corrected by ‘casting’ the computed result. For this you will need to use the SQL view of the query.
See my answer in this post → Base - Calculating Times
Edit 2019-03-06:
No you cannot use a calculated field until it has been "Select"ed. You can do what you want in multiple ways. Here are two.
Calculate the percentage and join to main select on the record ID:
You can also perform without a “Join” by doing the calculation twice:
This of course depends upon if you need both the percentage and the percentage plus original amount. If you just need a total then:
Select ID, Cast(("AMT1" *.25) + "AMT1" As DECIMAL(5,2)) As "Total" FROM "CalcTest"
will work also.
and then again the calculated field is unavailable ?
is the calculated field not available later in other calculated fields?
Ratslinger , Mike Kaganski
thank !!!
you helped me a lot
I implemented it
through
creating multiple queries
query based on another query, a computed field is also available
and in the future, the developers will not add this feature in the requests ?
@taifatul SQL is concerning the database and not LO. For ‘added features’ in that respect you need to deal with the database maintenance group. Don’t see this as a reasonable request though.
Please use original question for further information. Answers should be used for answering original question only.
By the way, the way you calculate your Bo+0,25
in the question’s screenshots doesn’t look like “salary + 25%”. It looks more like simple 25% of something (but name “БО_2_КАТ” looks like it’s base salary (базовый оклад)?) Anyway: if your “total” needs to be salary + salary*0.25, then it’s simple salary * 1.25.