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);
    }

 

pass parameter in axapta between a form


Step 1) Button Control Data Source Value

public void init()
{
    custTable _Custtable;
     ;
     super();
     if(element.args())
    {
         if(element.args().record() && element.args().record().tableID == tablenum( custtable))
         {
              _Custtable = element.args().record();
          }
     }
}

Step 2) overiding source form's button control clicked method

In Form1

void clicked()
{
  
    Args            args;
    Formview         Formview;
    ;

    args = new args();
    args.parm( "yourStringValue" );

    _args.name( formstr( FormB ) );
    Formview= classFactory.formviweClass( Args );
    Formview.init();
    Formview.run();
    Formview.wait();

    super();
}

In Form2

public void init()
{
    str             YourStringValueFromCaller;
    ;
    super();

    if( element.args() )
    {
        // get string parameter
        YourStringValueFromCaller = element.args().parm();

    }
}

Wednesday 10 October 2012

Report Deployment in Microsoft Dynamics Axapta 2012

Step by Step Report Deployment in Microsoft Dynamics Axapta 2012, it is Faster and Reliable

There are three way to deploy SSRS report
1.    Visual Studio
2.    Within AX workspace
3.    Report Shell


Below there are two reports for deploy shown in bold letter, you can right click and select Deploy Report in AOT, you can select two reports at a time and right click and select Deploy Element

you can select multiple report name, right click and select deploy


Info Log shows with statistic Success
You can see below deployment status for design name Success

 
To verify that Report is deployed or not so we go to DynamicsAX - Report Manager and refresh the page, you can see your Reports Name appeared here



Now let’s  do the same from Microsoft Visual Studio, here you can right click and see the option available like Build solution, Rebuild Solution, Deploy solution etc….
 



you can right click on report file and select deploy



Once you select deploy  you will get information in outpout window, below you can see 
Deployment status for design name : success





Now check the file which are available in Report manager, to cross verify you can delete the files from Report Manager and deploy once again so you can see the newly deployed file in report manager





How to deploy a report file thru Report Shell
Check step by step below images

Select Microsoft Dynamics AX 2012 management Shell from Windows Menu -Start - Administrator Tools

Make sure you are administrator or Right Click and select Run as Administrator

 
 you can find below screen shot which is pure command line based

Get - Command
Get - Command -Module Microsoft.Dyn*

Try

Get-AXReport     and          Publish-AXReport

Get-Help Get-AXReport

 


Get -AXReport - ReportName *
First time it may take a minute to show the output


If you wanted to see in grid view
$Reports Get-AXReport -ReportName *
$Reports : Out-GridView

You will get one window display as below

 
So now lets do publish report from command line
 
     Publish-AXReport -ReportName BIDemo*
 
It will display Deploying Reports and related artifacts
You can see DesignDeploymentSuccess : <Success>
 
 

 

 
Lets back to DynamicsAX - Report Manager, Refresh the page, you can see your reports deployed from command line


lets type command 

     Get -Command -Module Microsoft.Dyn*                 see above image Last Line

If you have problem with deploying

Type command line

     Test-AXReportServerConfiguration

See below image with result Testing the report server configurations completed, I would recommand to do it first



 


Thanks


Tuesday 9 October 2012

Reporting service error rsReportParameterValueNotSet

In Microsoft Dynamics Axapta if you get such error You must provide a parameter value


Solution

you can hunt for lookin your field in your current project for you are getting error

connect to analysis server and lookup your dimension, process the dimension

Select Update BI Data, ckick on update database


Under AOT go to the relavent table and browse

You can see query return with rows

Now go back to your project, open sql query and run the same , now you can find values

Save changes
Refresh role center

Problem is solved

Thanks

SQL list user name, database and permissionState

In Microsoft SQL Server How to list the User name and their role, Permission Type, Permission State

see all individual objects that each user has access to


SELECT 
    [UserName] = ulogin.[name],
    [UserType] = CASE princ.[type]
                    WHEN 'S' THEN 'SQL User'
                    WHEN 'U' THEN 'Windows User'
                    WHEN 'G' THEN 'Windows Group'
                 END, 
    [DatabaseUserName] = princ.[name],      
    [Role] = null,     
    [PermissionType] = perm.[permission_name],      
    [PermissionState] = perm.[state_desc],      
    [ObjectType] = CASE perm.[class]
                        WHEN 1 THEN obj.type_desc               
                        ELSE perm.[class_desc]                  
                   END,      
    [ObjectName] = CASE perm.[class]
                        WHEN 1 THEN OBJECT_NAME(perm.major_id)  
                        WHEN 3 THEN schem.[name]               
                        WHEN 4 THEN imp.[name]                   
                   END,
    [ColumnName] = col.[name]
FROM   
        sys.database_principals princ 
LEFT JOIN
       sys.server_principals ulogin on princ.[sid] = ulogin.[sid]
LEFT JOIN       
       sys.database_permissions perm ON perm.[grantee_principal_id] = princ.[principal_id]
LEFT JOIN
      sys.columns col ON col.[object_id] = perm.major_id
                    AND col.[column_id] = perm.[minor_id]
LEFT JOIN
    sys.objects obj ON perm.[major_id] = obj.[object_id]
LEFT JOIN
    sys.schemas schem ON schem.[schema_id] = perm.[major_id]
LEFT JOIN
    sys.database_principals imp ON imp.[principal_id] = perm.[major_id]
WHERE
    princ.[type] IN ('S','U','G') AND
    princ.[name] NOT IN ('sys', 'INFORMATION_SCHEMA')





or      try below query


select  
  princ.name,       
  princ.type_desc,       
  perm.permission_name,       
  perm.state_desc,       
  perm.class_desc,       
  object_name (perm.major_id)
from    sys.database_principals princ
 left join
        sys.database_permissions perm
on      perm.grantee_principal_id = princ.principal_id

Monday 8 October 2012

Error while AOS start in Axapta 2012

If you get error while starting AOS in Microsoft Dynamics Axapta 2012

Object Server 01:  The directory "C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\bin" does not exist or access to it has been denied by the operating system.

solution

Create following directories

C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\bin
C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\share\config
C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\appl\Standard
C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\appl\Standard\db
C:\Program Files\Microsoft Dynamics AX\60\Server\ax6conBG\bin\Application\appl\Standard\tmp

Start AOS and check it works fine.

Thanks

What is an X++ tools in Microsoft Dynamics Axapta 2012


X++ tools

X++ is Object oriented programming language

It used MorphX Development Environment

It has Similar Syntax like C#

It incorporates SQL data manipulation statements

Tools
                           To launch Workspace - Ctrl + Shift + W

                X++ code editor,               accessible from Developement Workspace

 

                X++ compiler,                    accessible from Developement Workspace


                X++ Debugger,                  accessible from Developement Workspace


                Visual Studio,           
                Visual Studio Debugger   accessible from Developement Workspace

                Debugger

               
          

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




 

Arrays in Microsoft Dynamics Axapta 2012

Array is a list of items with the same datatype and the same name, Only the index differs


Arrays can be declared by brackets [ ]

real      MyArray[];                    //unlimited index value
real      MyArray1[15];              //maximum 10 index value

myarray[1] = 1.1;
myarray[2]= 1.2;

etc...

for [i =1; i <= 15; i++)
   {
      print MyArray1[i];
   }

A container variable can contain different types and value of simle and extended data types, including arrays

container  xyz;

int             a,b;
xyz = [15, 30, "SempleText"];
print compeek(xyz,3);

 

Characteristics of X++ in Axapta 2012


Reliable
     X++ provides extensive compile-time checking,
     Memory management model is simple,
     Object create by New operator,
     Automatic garbage collection
     Eliminates entire classes of programming errors

Interpreted and dynamic
     Benefit from faster developement cycle prototyping,
     Rapid developement and experimentation

Interoperable
     components in AX are seamlessly available to any application supporting .Net,
     conversely x++ is able to consume external managed code and COM objects.


 

Change the font style based on parameter in SSRS

How to change font style in SSRS 2008, SSRS 2012


               Like

               "Bold", "Normal", "Thin", ExtraLight", "Light", "Medium",
               "SemiBold", "Bold", "ExtraBold", "Heavy"



If your Parameter ShowSummary  = True than  change the Font Style to  "Normal" otherwise "Bold"

Step 1)

Create Parameter ShowSummary
Data type : Boolean
Default Values, Click Add and type True (Defining default Value = True)


Create New Parameter as ShowSummary, data type Boolean


Set default value as False so by default summary value will be False


Right click on your textbox, Select Textbox Properties, Select Font, Click on the Fx button besides Bold


as per the parameter value, show font type

Now run the reports, you can see that when you select show summary = true your text box font type appears "Normal" or it will show in "Bold "

Thanks




Sunday 7 October 2012

SSRS 2012 Report Parameter and multiple filter code


//Define Parameters as below

   MbooleamParaMtr             as Boolean
   MMultipleSelectionParam as Multiple secection Txt Parameter

// your selection criteria as below

  select field1, field2
  from
           Table1
where
           @MbooleamParaMtr = 1                       or
            field1 In (MMultipleSelectionParam)

Saturday 6 October 2012

Index was outside the bounds of the array

you may face this issue when axapta 2012 excel import of data


solution

check mandatory fields should be present in entity you are trying to import