Tuesday, June 8, 2021

How to execute Date Time range in X++ query

Here is the example for datetime range in Query. We are trying to achive as on date data here based on AOT and an additional range of From Date. This will help to understand the query base. 

 Query     query = new query(querystr(#AOTQueryName)); // Getting Query From AOT , 
 QueryBuildDataSource qbds = query.dataSourceTable(tablenum(#TableName)); // Adding More DB
 queryBuildRange            qbr = qbds.addRange(fieldNum(#TableName,#FieldValidFrom)); // Add Range 

qbr.value(strFmt('(%1.%2 <= DateTimeUtil::date("%3"))',tableStr(HcmEmployment),fieldStr(HcmEmployment, ValidFrom),asonDate)); // Passing Value 

No comments:

Post a Comment

Conversion of Disposition code, code was not specified - Error in D365 F&O for inter company purchase order return

 We crated the return order for inter company purchase order  and created a Item Arrival Journal through Arrival Overview in corresponding c...