使用utcdatetime X ++查询范围

时间:2016-10-07 17:05:26

标签: axapta x++

我在X ++中查询时遇到了一些问题。

Query extended range failure: SPLCertificateSell.ValidFrom is not a valid datasource.field pair near pos 36.

我尝试使用utcdatetime查询QueryBuildRange但是我收到错误('validFrom'是dateTime而'DateTimeUtil :: getSystemDateTime()'返回utcDateTime):

qbrCertificateSell2 = qbdsCertificateSell.addRange(fieldNum(SPLCertificateSell, ValidFrom));
    qbrCertificateSell2.value(strFmt('( (%1.%2 <= "%3") )'
                                      ,tableStr(SPLCertificateSell)
                                      ,fieldStr(SPLCertificateSell, ValidFrom)
                                      ,DateTimeUtil::getSystemDateTime()
                                      ));

1 个答案:

答案 0 :(得分:1)

您需要将UTCDateTtime转换为System.DateTime尝试此功能:Global::utcDateTime2SystemDateTime()

例如,在您的代码中:

qbrCertificateSell2 = qbdsCertificateSell.addRange(fieldNum(SPLCertificateSell, ValidFrom));
qbrCertificateSell2.value(strFmt('( (%1.%2 <= "%3") )'
                                  ,tableStr(SPLCertificateSell)
                                  ,fieldStr(SPLCertificateSell, ValidFrom)
                                  ,Global::utcDateTime2SystemDateTime(DateTimeUtil::getSystemDateTime())
                                  ));