Jan 25, 2012

Three rules when declaring variables in X++?


  1.  Declare all variables before anything else in the code
  2.  Use a ';' (semicolon) after each declaration.
  3.  Use a ';' (semicolon) to separate the declarations from the rest of
the code.

Classes & methods that can be created in X++ and their differences.



The different kinds classes in AX are as follows:

1 Application classes - we implement them in X++, and they are located at AOT --> Classes.

2 System classes (or kernel classes) - They are implemented in C++. The source for these classes is not available in AX.
Ex :- xSession , xApplication ,xCompany ,xInfo ,xClassFactory ,xGlobal ,xVersionControl

3 Application substituted kernel classes are extensions of system classes.
EX :- Session , Application ,Company ,Info ,ClassFactory ,Global ,VersionControl


Object methods can only be activated by an object that has been

instantiated from the specific class. An object method is called as

follows:

Class_name ref_name = new Class_name ();
ref_name.testmethod();


Class methods can be attached directly to a class and do not need an

instantiated object to work. Use the 'static' modifier when you create

class methods. A class method is called as follows:

Class_name::testmethod();

If a report attached to a form ,how can the report display the values of the selected one in form?


suppose i put my report on the  CustPackingSlipJour  form then i selected on e record,i want to display the information of that particular record only in my report then the following code helps    

public class ReportRun extends ObjectRun
{
    CustPackingSlipJour     externalCustPackingSlipJour;
}

public void init()
{
    element.initFromArgs(element.args());
    super();
}

void initFromArgs(Args args)
{
    if (args && args.dataset())
    {
        switch(args.dataset())
        {
               case tablenum(CustPackingSlipJour) :
                                        externalCustPackingSlipJour  =   args.record();        
        }
     } 
}