Wednesday, March 8, 2017

Textbox color change condition

=iif((sum(sum((Fields!InvoiceAmount1.Value) * 4 / 100) + sum((Fields!InvoiceAmount1.Value) * 2 / 100)) = sum((Fields!InvoiceAmount1.Value) * 6 / 100)) ,"White","Orange")

Tuesday, March 1, 2016

Saturday, February 6, 2016

Create List Page in Dynamics AX 2012

Create “List Page” in Dynamics AX.
1)      Create New Project
2)      Right click on forms, select list page from “New form from template”  PIC1



3)      Create AOT query PIC2


Select table and drop fields in datasource
Create data source and drop the fields which you want to show on list page. PIC3












Goto form and set data source, give the reference of newly created query PIC4










Create new class
class HNListPageInteraction extends ListPageInteraction
{
}


8)  Goto form: Change the interaction class property and set to ListPageinteraction PIC5











9) Goto form: Design [Grid:ListPageGrid]
   Change DataSource "DataSource"
   DataGroup: (Create FieldGroup) PIC6












10) Create Menu and attach menu item in it PIC7



Friday, February 5, 2016

Create Simple AOT JOB in dynamics AX 2012

Create a Simple AOT Job:

Our first task is to show the values of a table, which are to be printed in Infolog.

For aforementioned scenario, a new AOT JOB has to be created by following the steps below:

Open Dynamics AX and press crtl + D.
Then, right click on Jobs and create new JOB
Next step is to write query, which will show all the values of a table:
Select “HCMEmployment”
Since HcmEmployment table does not contain Employee name, one must use Join between "HcmEmployment" and “DirPerson” on RecID to create a joint relationship by entering following code.
Code:
static void HN_AllEmp(Args _args)
{
    HcmEmployment    hcmEmployment;
    DirPerson        dirPerson;

    while selectfrom hcmEmployment join dirPerson where HcmEmployment.RecID == dirPerson.RecId
    {
    info(strfmt("Employee type '%1' and Name '%2'",hcmEmployment.EmploymentType,dirperson.Name));
    }

}

Once coding process is completed, then click on "Play" button.


Congratulations!!! Now you have accomplished a simple example.

Next step is to update the values of  a table while verifying that none of the values are negative.
Create new Table with single field int.


















HNTableInt contains different numbers. So, create a query, which will produce a result of negative values ,but before updating the values, convert all the negative values into positive numbers, using absolute value (abs).

  

Code:
static void multiply(Args _args)
{
    HNTableInt hNTableInt;
    int a = 0;
    ttsbegin;

    while select forupdate Multiply from hNTableInt
    {
        a = a - 1 ;

    hNTableInt.Multiply = abs(a) ;
    hNTableInt.update();

    info(int2str(hNTableInt.Multiply));

    }


    ttsCommit;
}


Have a nice day :)