在icCube

时间:2015-05-15 13:16:30

标签: jodatime iccube

我想使用以下MDX语句:

with member [x] as now()->plusMonths(1)->withDayOfMonth(1)->minusDay(1)
select [x] on 0
from sales

但我收到错误“withDayOfMonth”未知。 我知道函数“plustMonths()”工作正常。如何使其他Joda功能起作用?

以下行在icCube.xml中处于活动状态。如果需要,帮助明确说明添加子包,但我不知道withDayOfMonth是否是子包,我不知道在哪里找到它:

<allowedPackage>org.joda.time</allowedPackage>

1 个答案:

答案 0 :(得分:2)

不幸的是,now()正在创建一个内部日期/时间对象,它不支持所有JODA方法(我们将在下一个版本中添加它们)。与此同时,这里有几种计算月末的方法:

with
 // Be aware it is the server's 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]