Showing posts with label Grid Filter. Show all posts
Showing posts with label Grid Filter. Show all posts

Wednesday, September 3, 2025

Filtering records in grid in datasource init method

 This article is about filtering records in grid

>> Generally if it comes to  Filtering records we go for execute query but sometime we see this not that appropriate working so  we go for formdatasource init


code:-

[ExtensionOf(FormDataSourcestr(PurchReqCopyRFQ,PurchReqLine))]
internal final class PurchReqCopyRFQ_Extension
{
    public void init()
    {
        next init();
        QueryBuildRange qbrBuyingLegalEntity;

        FormDataSource          purchReqLine_ds;

       purchReqLine_ds =this as FormDataSource;
       purchReqLine_ds.query().dataSourceTable(tableNum(PurchReqLine)).clearRanges();

        qbrBuyingLegalEntity = this.query().dataSourceTable(tableNum(PurchReqLine)).addRange(fieldNum(PurchReqLine, BuyingLegalEntity));

        qbrBuyingLegalEntity.value(queryValue(CompanyInfo::findDataArea(curExt()).RecId));
        qbrBuyingLegalEntity.status(RangeStatus::Locked);
    }

 

}

Get enumvalues through sql

 Generally in AOT sometimes we can not see tthe basenum values in properties so here is the query which helps  SELECT     EIT.NAME AS EnumNa...