How to visualize only the last 10 orders in a case overview page using a Custom Query and APIs?
It may be a simple question but no matter how hard I try, I can't find a solution.
Here is the context:
Similar to the "Travel Request" tutorial, I have a case overview page but with one Table widget that allows me to see the status of my order (pending, rejected or approved). For instance:
Cust. | Status
1 | approved
2 | rejected
3 | pending
I can view my first 10 orders using the Default query "findByUserId" and, following the "Getting started tutorial", using a bdm API:
And everything works well.
Nevertheless, when I place my eleventh order, it is impossible for me to review it. Of course, I could put "c=11" in the bdm API above but I don't want to change it otherwise my list of orders would be too long.
That's why I would like to be able to visualize one of these 2 options:
1) orders from the last 5 days only: I have already tried using a Custom query but performing operations on dates in JPQL is actually more complicated than it seems. Although, I tried to do so with the help of the documentation provided by Bonita:
and using the following functions: CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP but nothing works.
Therefore, I tried something that seemed more accessible to me, the 2nd option below
2) my LAST 10 orders: I tried to do this with a Custom query:
FROM DistributionOrder d
WHERE d.userId = :userId
AND d.persistenceId >= :persistenceId-10
ORDER BY d.persistenceId ASC
Then, I simply use this API in my case overview page:
And yet, it doesn't work.
If someone has already encountered this problem, do you have a solution for me? I will be grateful because I no longer know how to proceed