Calculation in YARG reports

Hi
I have created a Purchase Order report (as attached, in word) which is working like charm. Now i want to adda column for the amount per item (quantity x price = amount ) and also need a total Purchase order amount under the table. I also want the amount in word. I searched the documentation but didn’t find anything like this unless I have missed it. Thanks for your help.

Template for report -Report for entity -Purchase Order–.docx (6.2K)

Hi
Additional calculations can be done while preparing data for dataset fields. ([url=https://doc.cuba-platform.com/reporting-6.2/structure.html?_ga=1.252033802.2030361064.1466500126]https://doc.cuba-platform.com/reporting-6.2/structure.html[/url])
F.e. by SQL:


select    se.INT_FIRST * se.INT_SECOND as multiply 
from TEST_SOME_ENTITY se

Or Groovy:


def result = []
def tx = persistence.createTransaction()
try {
    def em = persistence.getEntityManager()
    def query = em.createQuery('select se from test$SomeEntity se')

    query.getResultList().each {e ->
    result.add(['gSQRT': Math.sqrt(e.intFirst * e.intSecond)])
    }
    tx.commit()
} finally {
    tx.end()
}
return result