How to render complex amount calculation templates using Qute Templating Engine #51053
Replies: 2 comments
-
|
Is it not supported to use * or/for operations in the template? |
Beta Was this translation helpful? Give feedback.
-
Multiplication and division is not supported out of the box. Addition and subtraction is supported for integer numbers, but in sections the infix notation (which is used to implement
I would not recommend to do complex calculations in Qute templates. Qute was originally designed to contain minimal logic. Complex computations should be performed in the Java code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I configured a currency template that includes floating-point addition, subtraction, multiplication, and division calculations, but it consistently throws an error for multiplication.
template:
{#let total = messageNotify.reservationAdults * 285.23 /} {total}Error message:
ProcessNotificationTemplateContent:: io.quarkus.qute.TemplateException: Rendering error: Property "" not found on the base object "com.shijigroup.kunlun.biz.hotel.notification.config.metadata.NotificationDynamicParamDto" in expression {}
at io.quarkus.qute.TemplateException$Builder.build(TemplateException.java:169)
at io.quarkus.qute.EvaluatorImpl.propertyNotFound(EvaluatorImpl.java:234)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:204)
at io.quarkus.qute.EvaluatorImpl.resolveReference(EvaluatorImpl.java:131)
at io.quarkus.qute.EvaluatorImpl.evaluate(EvaluatorImpl.java:85)
at io.quarkus.qute.ResolutionContextImpl.evaluate(ResolutionContextImpl.java:29)
at io.quarkus.qute.Futures.collectAsyncResults(Futures.java:100)
at io.quarkus.qute.Futures.evaluateParams(Futures.java:44)
at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.evaluate(SectionNode.java:229)
at io.quarkus.qute.SetSectionHelper.resolve(SetSectionHelper.java:42)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:58)
at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:245)
at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:66)
at io.quarkus.qute.Parser$1.resolve(Parser.java:1331)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:53)
Could you please take a look and provide some examples of complex monetary calculation templates for me to refer to?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions