Monday, November 27, 2023

How to make grid empty based on conditions in D365 f&o X++

 I have grid with purchline datasource.

If the location is empty . Then grid should be empty.(no records in gird)

If the location has some range. then range should be applied on grid.


 QueryBuildDataSource            qbdspurch;

 QueryBuildRange                       qbr;

if(this.daxlocation)

{

                 qbdspurch = this.query().dataSourceTable(tableNum(PurchLine));

                    qbr = qbdspurch.addRange(fieldNum(PurchLine, daxlocation));

                    qbr.value(this.daxlocation);

}

else

{

                     qbdspurch = this.query().dataSourceTable(tableNum(PurchLine));

                    qbr = qbdspurch.addRange(fieldNum(PurchLine, PurchId));

                    qbr.value(SysQuery::valueEmptyString()); //makes grid empty

}

reference blog:

https://daxingwitheshant.blogspot.com/2015/04/how-to-filter-gird-based-on-given-input.html

No comments:

Post a Comment