Avoid Null values in Lookup (AX2009)
If you don't want to show Null Values in a lookup list
The below code avoid Null Values in Lookup.
Ex: Avoid Null values from lookup i.e If Qty is zero avoid those record in the lookup
;
// Limit and arrange the data selection.
queryBuildRange = queryBuildDataSource.addRange(
public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange,queryBuildRange1;
// Create an instance of SysTableLookup where 'this'
// is the current form control.
SysTableLookup sysTableLookup = SysTableLookup
::newParameters(tableNum(ItemControl),this);
;
// Add fields to be shown in the lookup form.
sysTableLookup.addLookupField(fieldNum(ItemControl, BatchNumber));
sysTableLookup.addLookupField(fieldNum(ItemControl, ItemId));
sysTableLookup.addLookupField(fieldNum(ItemControl, onhand));
// Limit and arrange the data selection.
queryBuildDataSource = query.addDataSource(tableNum(ItemControl));
queryBuildRange = queryBuildDataSource.addRange(
fieldNum(ItemControl, ItemiD));
queryBuildDataSource.addRange(fieldnum(ItemControl,ItemID)).value(ProdBOM.ItemId);
queryBuildRange = queryBuildDataSource.addRange(
fieldNum(ItemControl, onHand));
// To Avoid Null Values from ItemControl Table in //lookup
queryBuildDataSource.addRange(fieldnum(ItemControl,
Onhand)).value(SysQuery::valueNotEmptyString());
queryBuildDataSource.addRange(fieldnum(ItemControl,
Onhand)).value(SysQuery::valueNotEmptyString());
queryBuildDataSource.addRange(fieldnum(ItemControl,
Onhand)).value('!=0.00');
Onhand)).value('!=0.00');
sysTableLookup.parmQuery(query);
// Perform the lookup.
if(ProdBOM.ProdLineType == BOMType::Production)
{
sysTableLookup.performFormLookup();
}
else
{
super();
}
}
Any uncertainty regarding lookup email me i will help you folks..
Happy Daxing...
}
Any uncertainty regarding lookup email me i will help you folks..
Happy Daxing...
No comments:
Post a Comment