Hi, I created some navigation screen with native filter from Cuba.
If the screen entity has a transient attribute of type enum, this attribute is populated during execution.
To filter by this attribute I implemented a custom SQL filter based on an expected date and a deadline (number of days).
Each record has a different deadline. and to do the calculation I put a macro in my query: @dateAfter
In the cuba documentation we have this example:
select d from sales_Doc where @dateBefore (d.createTs, now + 1)
in the context of filters would look something like this:
@dateBefore ({E} dateLimit, now + 1)
and in my context it should look like this:
@dateBefore ({E} .dateLimit, now + {E} .deadLine)
but when I apply this filter, I have the following error:
CommonErrorNode [<mismatched token: [@ 184,515: 515 = 'e', <61>, 19:41], resync = e.deadLine>] at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke (ServiceInterceptor.java:124) ~ [na: na] at jdk.internal.reflect.GeneratedMethodAccessor197.invoke (Unknown Source) ~ [na: na] at java.base / jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) ~ [na: na] at java.base / java.lang.reflect.Method.invoke (Method.java:566) ~ [na: na] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs (AbstractAspectJAdvice.java:644) ~ [spring-aop-5.1.6.RELEASE.jar: 5.1.6.RELEASE] at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod (AbstractAspectJAdvice.java:633) ~ [spring-aop-5.1.6.RELEASE.jar: 5.1.6.RELEASE]
Hi Amasonas,
Unfortunately, JPQL macros allow only limited expressions, this is mentioned in the @between
macro description:
moment1, moment2 – start and end points of the time interval where the value of field_name should fall into. Each of the points should be defined by an expression containing now variable with an addition or subtraction of an integer number.