Monday 8 October 2012

Variables and Data Types in Microsoft Dynamics Axapta 2012

Variable is holding data when a block of code executes


Scope

Global to a class (in the class declaration of a class)
Local to a method (Variable define in a method of a class)
Local to an embedded function ( variable defined in a function embedded in a method of a class)

Declaration
Rules
  •           Declare variable before anything else in the code
  •           use a semicolon after each declaration
assign value 20 to xyz
                     int xyz = 20;

                     you can also create Extended datatype on the basis of primitive datatypes



Overview of  Data type


String
             Hold characters - maximum 999 character it can hold
             str     xyz = "testing";

Integer
            Hold natural figure - number without decimal point
             int     xyz  = 9;

Real
            Numbers with decimal point
             real     xyz = 9.19;

Date
            date type contains day, month and year
            date    xyz = 02/18/2012;

UTC dateTime
           Hold year, month, day, hour, minute and secons
           utcDateTime   xyz =  02/18/2012 10:10:02 am;

Enum
           It represented internally as integer, first literal has the number 0, the next number 1 and so on,
           use as expressions

           enum xyz = NoYes::Yes;

Boolean
            it contain value True and False only
            boolean   xyz ;

Time
            Contains hours, minutes and seconds
            timeOfDay  xyz;

Guide
           Means Global Unique Identifer(GUID) it is uniue i nany context

           GUID XYZ ; //{3f2504E0-4F89-11D3-9AA0-5030E82C1033}.

Int64
           hold large integer, 64bit
           Int64 xyz;


Variable with extended datatype

custAccount         _CustAccount;
amountMST         amountDb, amountCr;



Composite data types

Array
          It is a List of Ites with the same data types and the same name, Only Index Differs

Container
          It is a Dynamic list of items that can contain primitive data types and
          some composite data types

Classes
          A class is a type defination that describes both variables and methods for
          instances (method) of the class

Tables
          It is defined in the database, can handle class definations




 

No comments:

Post a Comment