Monday, January 6, 2014

X++ : Filter Enum Values on Form lookup Ax 2012 / Ax 2009


Often there are requirements/ design changes, where we need to filter and display on a few enum values in a Form lookup, For this purpose we can use the following code.
This code basically filters the enum based on the values from Set.


public class FormRun extends ObjectRun
{
    SysFormEnumComboBox         sysFormEnumComboBox;
    Set                         enumSet;// = new Set(Types::Enum);
}
In init method :

enumSet= new Set(Types::Enum);
    enumSet.add(MetalType::Gold);
    enumSet.add(MetalType::Silver);
    enumSet.add(MetalType::Palladium);
    enumSet.add(MetalType::Platinum);

    sysFormEnumComboBox  = sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(TTMetalRateCreate,acunder)),enumNum(MetalType),enumSet);



Hope This Helps
happy Daxing.

No comments:

Post a Comment