gpt4 book ai didi

jodatime - joda.time在icCube中的使用

转载 作者:行者123 更新时间:2023-12-02 19:04:52 29 4
gpt4 key购买 nike

我想使用以下 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()正在创建一个内部日期/时间对象,该对象尚不支持所有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]

关于jodatime - joda.time在icCube中的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30260535/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com