[ ax2012 ] two ways of filter form in ax 2012

Normal way

public void fetchInspection()

{
QueryBuildRange range;

range = SysQuery::findOrCreateRange(
UFOM_MillCertInspection_DS.query().dataSourceTable(tablenum(UFOM_MillCertInspection)),
fieldnum(UFOM_MillCertInspection, UFOM_InspectionCoilId));
range.value(UFOM_CoilId.valueStr());

UFOM_MillCertInspection_DS.executeQuery();
UFOM_MillCertInspection_DS.refresh();
}

Beautiful way ( ref : here )

Add at

/Forms/.../Data Sources/[table name]/Methods/executeQuery

public void executeQuery()

{
Query query;
QueryFilter queryFilter;
str pCoilId;

if(UFOM_CoilId.valueStr() != ""){
pCoilId = UFOM_CoilId.valueStr();
} else {
pCoilId = SysQuery::valueEmptyString();
}
query = UFOM_MillCertInspection_DS.query();
query.clearQueryFilters();
queryFilter = query.addQueryFilter(UFOM_MillCertInspection_DS.queryBuildDataSource(), fieldStr(UFOM_MillCertInspection, UFOM_InspectionCoilId));
queryFilter.value(pCoilId);
super();
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s