joda.time 在 icCube 中的用法
Usage of joda.time in 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>
不幸的是,now() 正在创建一个内部 date/time 对象,该对象尚不支持所有 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]
我想使用以下 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>
不幸的是,now() 正在创建一个内部 date/time 对象,该对象尚不支持所有 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]