Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Tuesday, July 2, 2013

Passing the parameter from form to class in Dynamic AX

      1. Create class.
class Form2Class
{
}

2. Create  a method to that class
void new(PurchID purchid)
{

;
info(purchid);
}

3.  Create a form with name Form2Class, datasource as purchTable and grid & button in design.

4. On the clicked method of that button
void clicked()
{
   // PurchTable      purchTable;
PurchID purchId;
Args args=new Args();
Form2Class      form2Class;
;
 purchId=args.parm(purchTable.purchid);
form2Class = new Form2Class(purchid);
}

String Function in Dynamics AX

1 – str2Capital () : Convert first character in to Capitalstatic void Jobtest(Args _args)        {
            str source,desti;
            ;
            source  = 'dynamics ax';
            desti   = str2Capital(source);
            info(strfmt("%1 : %2",source,desti));
        }
    Using str2CapitalWord() method convert the first character of the first word in Sentence to Capital.

2- str2Con () : Concatenate the word or sentence from specified characterstatic void Jobtest(Args _args)
        {
            str         source,desti;
            container   Con;
            int         i;
            ;
            source  = 'dyna,mics, ax';
            Con   = str2Con(source,',');
            for (i = 1; i <= conlen(Con); i++)
            {
                info(strfmt("%1",conpeek(Con,i)));
            }
        }
3-  str2Date() : Date in string type & return it as Date type static void Jobtest(Args _args)
        {
            str         input;
            Date        output
            ;
            input  = '05/30/2010';
            output  = str2Date(input,213);
            info(strfmt("%1",output));
        }
        123 : DMY
        213 : MDY
4- strIntOk () : Check a string which contain integer value static void Jobtest(Args _args)
        {
            str         input;
            boolean     output;
            ;
            input   = '1294';
            output  = str2IntOk(input);
            if(output)
                info(strfmt("Integer Value"));
            else
                info(strfmt("Not a Integer Value"));
        }
5- strEndsWith () : Check whether end characters are matching or not
static void Jobtest(Args _args)
        {
            str         input1,input2;
            boolean     output;
            ;
            input1  = 'dyanmics ax';
            input2  = 'ax';
            output  = strEndsWith(input1,input2);
            if(output)
                info(strfmt("OK"));
            else
                info(strfmt("Not OK"));
        }
6- strLFix  :  strLfix(str _str, int _lenght [, char _char])
Add character _char after string _str to obtain a string long _leng.
Default filler chararcer is ' '.
strLfix('aaa', 5, '_') //returns the text string 'aaa__'.
If _str is longer than _leght function return a substring of _str.
strLfix('dynamics ax',5);

//returns the text string ‘dynam'.

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...