我必须在executeQuery中进行 Query ,并且必须按日期字段进行过滤, 我的代码是:
I have to made a Query in executeQuery , and I have to filter by date field, my code is :
public void executeQuery() { utcDateTime dateUTC, datenullUTC; query q = new Query(); QueryBuildRange qbr; QueryBuildDataSource qbds ; QueryRun queryRun; dateUTC = DateTimeUtil::newDateTime(_dateValue, 0, DateTimeUtil::getCompanyTimeZone()); qbds = q.addDataSource(tableNum(MCRCustCategory) ); qbds.addRange(fieldNum(MCRCustCategory, ValidTo)).value(strFmt ("> %1", dateUTC) ); queryRun = new QueryRun (q); super(); }在我的init中,我调用了 executeQuery ,但没有在表单中进行过滤.
In my init I call the executeQuery, but don't filter in my Form.
如何使用范围中的日期?
How to use the date in the Range ?
谢谢,
享受!
推荐答案您使用的表使用生效日期.您认为必须自己进行选择,这是不正确的.
You use a table which use date effective. You assume you have to do the selection yourself, this is not true.
改为使用此:
public void executeQuery() { this.queryBuildDataSource().validTimeStateAsOfDate(_dateValue); super(); }如果有间隔,请改用此间隔:
If you have an interval, use this instead:
this.queryBuildDataSource().validTimeStateDateRange(fromDate, toDate)问题中提供的代码根本不做任何事情,因为表单不使用您构建的查询.反正您建立了错误的查询!
Your code as provided in the question does not do anything at all, as the form does not use the query you build. You buildt the wrong query anyway!
此博客帖子对此进行了简要说明.
This blog post explains it concisely.
更多推荐
如何按日期范围值过滤执行查询?
发布评论