Using joda.time in icCube
I would like to use the following MDX statement:
with member [x] as now()->plusMonths(1)->withDayOfMonth(1)->minusDay(1)
select [x] on 0
from sales
But I am getting the error "withDayOfMonth" unknown. I know the "plustMonths ()" function works great. How can I get this other Joda function to work?
The following line is active in icCube.xml. The help explicitly states to also add child packages if required, but I don't know if cDayOfMonth is a child package, and I don't know where to find it:
<allowedPackage>org.joda.time</allowedPackage>
+3
source to share
1 answer
Unfortunately now () creates an internal date / time object that doesn't support all JODA methods yet (we'll add them in the next version). Meanwhile, here are some ways to calculate the end of the month:
with
// Be aware it is the server end of month not the client, if you don't see the problem you've been lucky...for the time being.
// using MDX functions ( function can be added to the schema )
function ic3_EOM() as DateTime( now().year() , now().month() +1, 1 )->plusDays(-1)
// using JODA DateTime ( function can be added to the schema )
function ic3_EOM_2() as J!org.joda.time.DateTime()->plusMonths(1)->withDayOfMonth(1)->minusDays(1)->toLocalDate()
member [ic3_EOM] as ic3_EOM()
member [ic3_EOM_2] as ic3_EOM_2()
select { [ic3_EOM], [ic3_EOM_2] } on 0 from [sales]
+2
source to share