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

 

Wednesday 7 November 2012

Security for Developers in Axapta 2012

A developer defining more granular security levels by setting
access on tables and controls in a form, or by associating classes that perform an
action with a permission.

Friday 26 October 2012

Client Workspace in Microsoft Dynamics Axapta 2012

It is the standard rich client interface , used by end-user


List of Components in WorkSpace

    Navigation Pane
           Menu on left side of screen that shows all of the modules the current user has access to

    Content Pane
           It displays  
                          Role Center, 
                          List Pages and  
                           Area Pages

           Role centers display
                     Specific data
                     Reports
                     Alerts and 
                     Common tasks associated with users role in the organization

                     It display when end-user opens the application or goes to Home in Navigation pane

          List Pages Display
                    List of data
                    Optimized to view and search and 
                    Act on information

          Area Pages Display
                     All menu items relevant to module selected in Navigation pane
                     Grouped Logically, it is easy for end-users to find what they need





Saturday 13 October 2012

Visual Studio Project in Microsoft Dynamics Axapta 2012

Visual Studio Project used to interact with Microsoft Dynamics Axapta, Allow developer to create subset of elements

Three types of Visual Studio Project can be used to develop

1.   Report Modeling Projects

       It has own templates provided under the microsoft Dynamics Axapta template group

2.   Enterprise Portal Web Application Projects

       It has own templates provided under the microsoft Dynamics Axapta template group

3.   Managed Codce Projects
      Once this project is created in visual studio, Axapta elements from application explorer can be added to it by drag an element from application explorer in to project solution explorer

    node representing the element will be in the project, also referred to as proxies

Create Evenet handlers in Managed code
      1. Open  Visual Studio.
     2. Create Managed Code project.
     3. Rename class like MyPreEventHandler
     4. Save your project.
    5. Build class,then Build MyPreEventHandler.
    6. Right-click on project in Solution Explorer and select Add
       "Project Name" to AOT.

    7. If the Application Explorer is not visible, open the same.
    8. In the code editor, open the MyPreEventHandler class and place
        cursor somewhere inside the class.

    9. In the Application Explorer, locate SalesFormLetter class.
       Expand the same and locate the run method.

    10. Right-click the run method and select Add pre event handler.
    11. make sure that event handler method is created

Deploying Managed code
     1. Build the project.
     2. Right-click project and add the same to AOT.
     3. Set deployment properties for the project.
     4. Right-click project and deploy the project.

In procedure VB.net used instead of C#

Friday 12 October 2012

Locking in Axapta 2012

Multiple user is trying to access the database, same time users wnats to lock the same records at the same time

 
If first user lock the record another user wait until the record is realesed by first user
 
Incase of dead lock arrived, transaction must be aborted
 
when overlapping transactions editing the same data is small, optimistic locking increase concurrency and thus transaction throughput. Enable OCC for a table by setting the property OccEnabled to Yes
 
   Never implement dialog with the user inside a transaction.
 
  Try to lock central resources in the same order. This avoids the dead
  lock situation discussed previously. This serializes the process,
  which means that only one user can perform this at a time.
 
  Try to avoid locking central resources.

  Keep the transactions as short in time as possible. Do not
  compromise the integrity of the data.
 
 
Locking is held when it takes to finish the process
 
Process of locking
 
Process 1                          Process 2                      
Item C -                           Locked -
Item A -                           Locked -
Item B -                           Locked Item G - Locked
Item G - Waiting for lock from     Item A - Waiting for lock from
Process 2                          Process 1
 
 
    ttsbegin;
    while select inventTable
    {
        if
          (CustTable::find(branchTable.PrimaryBranchid).Blocked == CustBranchBlocked::All)
            {
                BranchTableUpdate = BranchTable::find(BranchTable.BranchId, true);
                BranchTableUpdate.PrimaryBranchId ="";
                BranchTableUpdate.update();
             }
     }
     ttscommit;
 * ------------------------------------------------------------------------------------------------------------*
    while select forupdate inventTable
                       exists join vendTable
    where vendTable.AccountNum == inventTable.PrimaryVendorId &&
                     vendTable.Blocked == CustVendorBlocked::All
 

Methods Used in Array in Axapta 2012

In microsoft Dynamics Axapta, use of Methods in Array

 
  • It hold value of any Single type, either it is objects or records 
  • such kind of objects can transferred to methods and functions

Methods

1.       exist(int)
          In arrya to check value is exist in desire positions
 
2.       lastIndex()
          To stores Maximum index value in array
 
3.       value(jnt_index, [anytype_value])
           It do gets or sets the value of the array member that is stored at the specific index

Check below details, it holds three differant query object.

Array array = new Array (Types::Class);

array.value(1, new Query());
array.value(2, new Query());
array.value(3, new Query()); 

 

Thursday 11 October 2012

Show User is already logged in in Axapta

If you would like to restrict single user name/Id to get multiple session in axapta, try below



select count(recid) from clientSession where clientSession.userId==curuserid() &&
                                                                         clientSession.status!=0                 &&
                                                                clientSession.sessionType==0;

    if(clientSession.recid>1)
    {
          for(myloop=1,myloop<=150,myloop++);
         {
            progress.incCount();
            progress.setCaption("Alert")
            progress.setText(strfmt("  '%1' is already logged-in",curuserid()));
            sleep(5);
         }
     infolog.shutDown(true);
    }