Create Custom Filter in d365 through x++
For creating a custom filter in d365 like this shown below, you must follow the following steps:
Ø
Create an
Enum of your status like below.
Ø
Create the field of status in your table and apply
Enum to your status field.
Ø
Declare the variable of Query Filter at the start
of the form.
QueryFilter queryFilter;
Ø
Create the init and execute query method on the data
source of the form like below;
public void init()
{
super();
queryFilter = TABLE_ds.query().addQueryFilter(TABLE_ds.queryBuildDataSource(),"Status");
}
public void executeQuery()
{
queryFilter.value(element.design().controlName("AllCreatedClearedField").valueStr());
super();
}
Ø
Now create the combo box field and add the enum
value to the combo box like below;
Ø
Now create the method modified on the combo box
field like below ;
[Control("ComboBox")]
class AllCreatedClearedField
{
public boolean modified()
{
boolean ret;
ret = super();
queryFilter = TABLE_ds.query().addQueryFilter(TABLE_ds.queryBuildDataSource(),"Status");
TABLE_ds.executeQuery();
return ret;
}
}
Comments