Saturday, December 24, 2022

How to add range on AOT query and X++ with two different columns.

Hi All,
Let's learn about how to add two different data source columns range on one column range in AOT Query. also i am covering how can we apply same on X++ query.


Apply range on 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(yourDatasourcename)).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 column of my data source.

ex - (TestReqShippingDate > TestAllPOLinesView.TestConfirmedShippingDate)



No comments:

Post a Comment

How to show default value or first value for the field which is not part of group and returning more than one values

Grouping Data by Certain Fields and Handling Cases Where a Specific Field Returns More Than One Value in D365FO SSRS Report...