Friday 12 October 2012

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