Jan 24, 2012

How to delete all the transactional data in AX ?


Run the class " SysDataBaseTransDelete " à It will prompt wheather you want to delete all the transactional data

How to reverse a string in AX?

A simple job to reverse a string


static void strReverve(Args _args)
{
str  s;
int  i;
;
s =  'Test Info';
info(strReverse(s));
}

How to display a Bitmap ?


Simple code to display a bitmap image

display Bitmap footerImage()
{
    ;
    return SysResource::getResourceNodeData(SysResource : : getResourceNode('Name of the Image'));
}

The image should be in AOT --> Resources

How to filter the data based on combo selection ?


DataDic-->Tables--->MedicineTable-->Fields

ItemId(string)
ItemExpired(enum)
ExpiryDate(date)

Medicine-->BaseEnums-->ItemExpired
ItemExpired :: Yes
                      No
                      All

MedicineInfoForm-->Methods-->classDeclaration

public class FormRun extends ObjectRun
{
    QueryBuildRange qbr;
}

 MedicineInfoForm -->DataSources--> MedicineTable -->Methods-->init()

public void init()
{
;
    super();
    qbr =    MedicineTable_ds.query().dataSourceTable(tablenum( MedicineTable )).addRange(fieldnum( MedicineTable ,ItemExpired));
    qbr.value(queryValue(ComboBox.selection()));
}

MedicineInfoForm-->Design--->Design-->Group : ItemExpired--->ComboBox:combobox-->Methods-->
modified()

public boolean modified()
{
    boolean ret;

    ret = super();

    if(combobox.selection()== ItemExpired::All)
    {
    qbr.value('');
    }
    else
    {
    qbr.value(queryValue(ComboBox.selection()));
    }

     MedicineTable_ds .executeQuery();

    return ret;
}

Display the data on the title bar


Code to disply the emp_id on the title bar of the form

Path : MyEmplForm-->Data Sources-->MyEmplTable-->Methods-->active()


public int active()
{
    int  ret;
    ret  = super();
    element.design().caption(EmpLeaveDetails.Emp_Id);
    return  ret;
}