Monday 17 November 2014

Operators in Microsoft Dynamics Axapta 2012

It is used to change the value in variables and fields to control the logical program flow


Types of Operators

     In below example variable i is an integer

     Assignmant Operator
     Modify the contents of a variable or field
     
      =       assign the expression on the right of the equal sign to the variable on the left  

     -=      Decrements the variable on the left by the value on the right
               example :   i -= 4;  Decrement i variable by four every time

     --       Decrements the variable on the left by one
               example :  i--;    Decrement i variable by one

    +=      Increments the variable on the left by the value on the right
               example :  i+= 3;   Increment i variable by Three every time

    ++      Increments the variable on the left by one
              example :   i++;    increment i vaariable by one


     Arithmetic Operators
     Mathematical operations on the values in a variable or field

     +         Plus         -    Adds expression1 to expression2

     -          Minus      -    Subtracts expression2 from expression1

     *         Multiply   -    Multiplies expression1 with expression2

     /         Divides      -    Divides expression1 with expression2

  DIV   Integer          -   Performs an integer division of expression1 with expression2.
            Division       
                                  example : i = 80 DIV 13, Return value of   i = 6  ( i.e.  6*13 = 78, Remainder 2)

 MOD  Integer       -   Returns the rest of an integer division of expression1 with expression2
           Remainder     
                                   example :   i = 80 MOD 13, Return value of i = 2  (i.e. 80/13 - remainder is 2)

     ~         Not           -  Unary operator: performs a binary notoperation

    &    Binary And   -  Performs a binary and-operation on expression1 and expression2

    ^     Binary XOr  -  Performs a binary XOR-operation on expression1 and expression2

     |      Binary Or    -  Performs a binary or-operation on expression1 and expression2

   <<   Left Shift     -  Performs expression2 left shift (a multiplication with two) on expression1
                               
                                  example :  i = 3 << 3;      Retuen value of  i=24    (  i.e.    i = 3*2*2*2)

   >>   Right Shift   -  Performs expression2 right shift (a division by two) on expression1
                              
                                 example :   i = 24 >> 2; Retuen value of i=6    ( i.e. i = 24/2/2)

   ?      Ternary      -  Takes three expressions: expression1 ?
         Operator          expression2 : expression3. If expression1 is true,
                                 expression2 is returned otherwise expression3 is returned
      



     Relational Operators
     Evaluate how two values relate to one another and return either True/False according to the result

     ==     equal Returns true if both expressions are equal

     >=     greater than or equal Returns true if expression1 is greater than or equal to expression2

     <=     less than or equal Returns true if expression1 is less than or equal to expression2

     >       greater than Returns true if expression1 is greater than expression2

     <       less than Returns true if expression1 is less than expression2

     !=     not equal Returns true if expression1 differs from (not equal to) expression2

    &&   and Returns true if both expression1 and expression2 are true

     ||       or Returns true if expression1 or expression2 or both are true

     !        Not A unary operator.
              Negates the expression.Returns true if the expression is false, and false if the
              expression is true

   like  
              Like Returns true if expression1 is like expression2.
              This can use * as a wildcard for zero or more characters and ? as wildcard for one character
              Example : 'xyzpqr' like 'xyz*', Retuen value True
                           'xyzpqr' like 'xyz?', Retuen value False

 

No comments:

Post a Comment