Sunday, December 21, 2014

Ternary Operator (?) In AX 2012

static void TernaryOperatorExample(Args _args)
{
    int number = 10;
    int n;
    ;
    n = (number > 9) ? 10 : 20;
    info(strFmt("%1",n));

}

Saturday, December 20, 2014

Some Important Points.

1) Differece Between Static Method and Normal Methods
=>Static method should start with static keyword.
=>Normal Method should start with Private ,Protected or Public.
=>we can't use this keyword in Static Method. In Normal Methods We Can.
=>We can Access the Static Method Using the Scope Resulution Operator(::).
=>But Normal methods we can access with in the class using the "THIS" keyword.
2) Display Method Precautions
          => Create Display method in Table Level and It should returns a value.
          => In form level create the one field and set Datasource for that field is mandatory after you should mention the property Datamethod. In that Property you need to mention the display method name with out brackets.



static void GetWorkerStatus(Args _args)
{
    HcmWorker              hcmWorker;
    HcmWorkerStatus    hcmWorkerStatus; // Enum
    ;
    while select hcmWorker
    {
        if(hcmWorker)
        {
            if(hcmWorker.workerStatus() == HcmWorkerStatus::Terminated)
            {
                info(strFmt(" %1 - %2 ", hcmWorker.workerStatus(),hcmWorker.name()));
            }
        }
    }
}