Wednesday, September 2, 2020

Filtering Records in a Form in AX 2012 using X++

 Hi guys,Today we see Filtering records in a Form in AX 2012 using X++.


Based on My Combo Box selection I have to filter the record in grid

On Form ClassDeclaration:

public class FormRun extends ObjectRun

{

        QueryBuildRange qr;

}


Apply the Range on Form DataSource Init():


public void init()

{

    super();

   qr=this.query().dataSourceName('InventSum').addRange(fieldNum(InventSum,Itemid));

}

On Form DataSource executeQuery():

   public void executeQuery()

{

      qr.value(Gender.valueStr());

      super();

}


IF its Enum Type Write Code on Selection change Method.

On ComboBox SelectionChange() Method Call Data Source Execute Query():

public int selectionChange()

{

    int ret;

    ret = super();

    InventSum_ds.executeQuery();

    return ret;

}


IF its String or int Type Write Code on modified Method.


public void modified()

{

    int ret;

    ret = super();

    InventSum_ds.executeQuery();

    return ret;

}


Keep Daxing!!

No comments:

Post a Comment