How to add range on AOT query and X++ query with two different columns.
Let's learn about how to add two different columns range on one column value of range in AOT Query.
Only the point to be consider is we need to use parenthesis correctly and Proper enum name -
DocumentStatus::None.
Apply range on X Query.
Override the execute query method of your form Datasource and add below code.public void executeQuery()
{
//Clear ranges.
this.query.dataSourceTable(tableNum(TestAllSOLinesView)).clearRanges();
Query query = new Query(this.query());
QueryBuildDataSource TestAllSOLinesView_ds1 = query.dataSourceTable(tableNum(TestAllSOLinesView));
queryBuildRange queryBuildRange = TestAllSOLinesView_ds1.addRange(fieldNum(TestAllSOLinesView, DocumentStatus));
queryBuildRange.value(strFmt('((DocumentStatus == %1) || ((TestConfirmationStatus == "%2")
&& (DocumentStatus != %1)))',any2int(DocumentStatus::None),
any2int(TestConfirmation::ToBeConfirmed)));
this.query(query);
super();
}
AOT Range on 2 different date columns
Refer below screen shot - I have set the value property with greater than condition on two date columns of my data source.
ex - (TestReqShippingDate > TestAllPOLinesView.TestConfirmedShippingDate)
Thats It. Happy Coding.
This was originally posted here.

Like
Report
*This post is locked for comments