Pages

Banner 468 x 60px

 

Thursday, December 25, 2014

Microsoft Dynamics AX Dates And Time functions

0 comments
today() ————————————>The today function returns the system date,This function does not support time zones. getSystemDateTime() —————>Gets the current UTC time as a utcdatetime type.
systemDateGet () ———————->The systemDateGet method uses the system date in Microsoft Dynamics AX.
  • Use DateTimeUtil::getSystemDateTime instead of systemDateGet or today. The today function uses the date of the machine. The systemDateGet method uses the system date in Microsoft Dynamics AX. Only DateTimeUtil::getSystemDateTime compensates for the time zone of the user.
  • Avoid using date2str for performing date conversions.
currentDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::utcNow(), DateTimeUtil::getUserPreferredTimeZone());
Job
date d;
str time1=”0.50″;
TimeOfDay time;
time = str2time(time1); ———————————————————> convert the String to Date
info(strFmt(“%1″,dayName(dayOfMth(today())))); ———————-> Name of the day in String
print dateMthFwd(systemdateget(),5);  ————————————>  forward to the 5 months
print dateMthFwd(systemdateget(),-5); ————————————> Backward to the 5 Months
 pause;
 Date to String Conversion
info(date2str(today(),123,2,2,2,2,4));
info(date2str(systemDateGet(),123,2,2,2,2,4));
info(date2str(DateTimeUtil::date(DateTimeUtil::getSystemDateTime()),123,2,2,2,2,4));
Get the time in milliseconds
str  milliSecondsAlive = int2str(winApi::getTickCount()); ——————–> Time in MilliSec
str  timeStr;
timeStr = strFmt(“%1 %2″, time2str(timeNow(), 3, 1), substr(milliSecondsAlive, strlen(milliSecondsAlive)-2, 2));
Date And Time Stuff
    str time1=”0.50″;
    TimeOfDay time;
    time = str2time(time1);
    info(strFmt(“%1″,time));                                                                   //convert time ToDate string
    info(strFmt(“%1″,dayName(dayOfMth(today()))));           // Name of the Day in String

Read more...

How to Fix “Insufficient Space” in Android

0 comments

Cara Mudah Mengatasi “Insufficient Space” Pada Android
Smartphone berbasis Android saat ini makin banyak digunakan bukan lagi karena tren atau sekedar ikut-ikutan. Banyak orang yang sudah sadar akan manfaat sebuah smartphone atau gadget berbasis Android lainnya dalam menunjang pekerjaan mereka sehari-hari. Sebuah smartphone handalpun kemudian menjadi pilihan untuk menghindari hal-hal yang tidak diinginkan selama beraktifitas menggunakan Android terjadi.

Canggih dan dibekali dengan kemampuan yang luar biasa bukan jaminan sebuah smartphone berbasis Android atau gadget lainnya terlepas dari masalah teknis yang sering terjadi seperti smartphone menjadi lambat, kekurangan memori, dan juga pesan error “insufficient space on the device” yang terjadi pada aplikasi Google Play Store di Androidmu.
Softrickinfo juga sempat mengalami pesan error bertuliskan “insufficient space on the device” ketika akan mengupdate dan menginstal beberapa aplikasi melalui Google Play Store. Setelah mencari referensi di melalui mesin pencari, Softrickinfo menemukan beberapa cara untuk mengatasi masalah yang bisa menyerang pada semua pengguna Android ini.
Setelah mengikuti beberapa petunjuk dan mendownload serta menggunakan aplikasi untuk memperbaikinya, ternyata pesan error tersebut tidak 100 persen hilang. Setelah membaca ulang semua referensi yang sempat digunakan, akhirnya Softrickinfo menemukan satu hal yang sama pada setiap artikel untuk masalah ini, yaitu:
“Masalah insufficient space on the device adalah penyakit atau masalah yang sering terjai pada aplikasi Google Play Store versi terbaru”.

Sayangnya tidak dieritahukan Google Play Store terbaru versi berapa yang dimaksud. Dari situ Softrickinfo menyimpulkan bahwa masalah “Insufficient Space” ini bisa diatasi dengan cara menguninstal update Google Play Store yang Softrickinfo gunakan.

Inilah cara mengatasi “Insufficient Space” di Android yang Softrickinfo lakukan. Pertama, masuk ke menu Settings. Pilih Apps atau Aplikasi, setelah itu cari aplikasi Google Play Store. Kamu bisa menemukannya di beberapa Tab Menu yang ada, Softrickinfo menyarakan untuk menggunakan tab All agar bisa melihat semua aplikasi yang terinstal secara lengkap.
Setelah kamu menemukan aplikasi Google Play Store, tap atau sentuh aplikasi tersebut hingga memunculkan tampilan menu baru. Selanjutnya tap menu “Uninstall Update” lalu keluar dari menu Settings dan coba update atau instal beberapa aplikasi yang kamu inginkan di Play Store.

Cara mudah mengatasi “Insufficient Space on The Device” di Android ini sudah berhasil diterapkan di Smartphone Android Samsung Galaxy Young
Read more...

Wednesday, September 17, 2014

Unable to logon On Microsoft Dynamics, SSRS reports error only with one user

0 comments

Unable to logon On Microsoft Dynamics, SSRS reports error only with one user

 

Solution :

Setting the Reporting Services Execution Account to the same user as the Dynamics AX Service Account solved this issue for me.

Read more...

Wednesday, September 10, 2014

Solution for the error-”This computer could not authenticate with Domain Controller”

0 comments

Solution for the error-”This computer could not authenticate with Domain Controller”

Sometimes in an Active directory environment administrators may find problems that the Domain users/administrators are not able to login to a member server or a client where they can able to login as local admin. Upon  checking the logs they can see  this error – This computer could not authenticate with Domain Controller with the following detailed error message.
“This computer could not authenticate with DomainController’ a Windows domain controller for domain DOMAIN, and therefore this computer might deny logon requests. This inability to authenticate might be caused by another computer on the same network using the same name or the password for this computer account is not recognized. If this message appears again, contact your system administrator.”
Possible causes
  • The problematic system was powered off more than the days the password expiry days mentioned in the domain group policy.
  • The secure channel between DC and problematic system is broken.
Possible solutions
  • Make the server back to Workgroup and rejoin the domain.
  • Reset the computer password, to do this follow the steps below
1. Go to the member server as local admin;
2. Issue the command “klist purge” to clear the Kerberos ticket cache on this server. If your server doesn’t have klist command, you could download it from:
http://www.microsoft.com/en-us/download/details.aspx?id=17657
3. Type the command “netdom resetpwd /s:x.x.x.x  /ud:domain\User /pd:*”
In this command, please use the PDC’s IP address replace the x.x.x.x; Use your domain administrator replace the domain\user, like this “your domain\administrator”
4. After that, the system will ask your domain administrator’s password, please type it on CMD;
5. After the execution of all commands you should restart the machine and try to login with the domain admin user.
If this is not working Make the server back to Workgroup and rejoin domain to do it without losing its SID follow these two steps.
  • In AD right click the computer and select Reset Account. Then re-join without un-joining the computer to the domain. Reboot required.
  • In an elevated command prompt type: nltest /Server: ServerName /SC_Reset:Domain\DomainController  No rejoin. No reboot.

Read more...

Friday, August 15, 2014

Microsoft Dynamics AX 2012 Reporting - tips how to improve performance

0 comments
There are some tips we can use to improve performance of reports for Dynamics AX 2012.
  1. Use static reports. The deployment of static reports is described here: http://technet.microsoft.com/en-us/library/hh496446.aspx In this way we will safe several calls to Metadata service to get labels values and correct formatting of dates and numbers.
  2. Install application hotfix KB 2879661 which fix the situation when first generation of a report after Dynamics AX client restart takes long. This happens for each user.
  3. Newest kernel. Hotfixes for performance improvement are included in new kernels that are released; sometimes there is a dramatic impact on performance.
  4. In the morning a first report generation takes a lot of time
SSRS uses session pooling. The first request that comes in from a user – a session will be created for them within the AOS services. Each user gets a session cached on the AOS services, so subsequent calls just reuse the session which matches the user who is making the request. This means that the first time this is created for the user the report will perform slower.
SSRS also uses a metadata cache the first request coming in which needs a certain piece of metadata, the metadata is read from the application code, and then cached in SSRS so it doesn’t have to read it subsequent times. There is one metadata cache for all users – once an object is cached in metadata, the services don’t go back to the code and retrieve it again, and they just read from cache, until the cache is cleared. This is also why a report may become slower the first time it is run.
The RecycleTime is used to restart the application domain which causes a refresh of the metadata.You could edit the RecycleTime (value is in Minutes) to therefore stop the cache from clearing and which then stop the extra hop to the AOS to gather the metadata.
Edit the <RecycleTime> element within:
RSReportServer.config (http://technet.microsoft.com/en-us/library/ms157273.aspx )
Open the RsReportServer.config file.
•              If you are using SQL Server 2008, the default location of this file is: \Program Files\Microsoft SQL Server\MSRS10.[SSRSInstanceName]\Reporting Services\ReportServer.
•              If you are using SQL Server 2008 R2, the default location of this file is: \Program Files\Microsoft SQL Server\MSRS10_50.[SSRSInstanceName]\Reporting Services\ReportServer.
•              If you are using SQL Server 2012, the default location of this file is: \Program Files\Microsoft SQL Server\MSRS11.[SSRSInstanceName]\Reporting Services\ReportServer
The default value is 720 (the value is in min so it is 12 hours.
NOTE:
Problems you may see when deploying reports because of metadata caching.
A new field is added to a table in AX, the field is used on a report in VS. The report deploys to SSRS.
However when the report is called, it fails on the new field.
This is because SSRS caches metadata. The new object is not recognized as the old metadata is still cached
The other solution is when every morning the first user has to wait for report very long is to pre-warm up the specific report. We would have to choose those reports which are critical for customer and have to run fast regards the time. To pre-warm up the report we can:
  1. Run report in batch job ie. SalesInvoice report:
public void run()
    {
       SrsReportRunController controller = new SrsReportRunController();
    SrsReportDataContract contract;
    SalesInvoiceContract rdpContractClass;
    LogisticsAddressCountryRegionISOCode code = "US";
    // establish the report name
    controller.parmReportName(ssrsReportStr(SalesInvoice, Report));
    // suppress the parameter dialog
    controller.parmShowDialog(false);
    controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
    controller.parmReportContract().parmPrintSettings().overwriteFile(true);
    controller.parmReportContract().parmPrintSettings().fileName("c:\\TEMP\\DummyReport.pdf");
    // set the required parameter.
    contract = controller.parmReportContract(); 
    rdpContractClass = contract.parmRdpContract() as SalesInvoiceContract;
    rdpContractClass.parmCountryRegionISOCode(code);
    // start the operation
    controller.runReport();
    }
2. Run Power-Shell script. . This solution is not so easy as we need to specify correct parameters which is not so obvious in Dynamics AX case. So to get parameters values we can run following SQL on Reporting Services database (this is SalesInvoice example):

SELECT e.timestart,DATEDIFF(ms,e.[timestart],e.[timeend]) AS [TotalTime]
,e.[timedataretrieval] AS [DataRetrievalTime]
,e.[timeprocessing] AS [ProcessingTime]
,e.[timerendering] AS [RenderingTime]
,COALESCE([AdditionalInfo].value( '(/AdditionalInfo/RdceSnapshotGenerationTime//node())[1]', 'int'),0) AS [RDCESnapshotGenTime]
,e.*
FROM [executionlog2] e

There is column Parameters. Which looks in my case following:
AX_PartitionKey=initial&AX_UserContext:isnull=true&AX_RenderingCulture=en-us&AX_CompanyName=CEU&FormLetterRecordId=0&PrintCopyOriginal=Original&RecordId=22565421785&LedgerJournalTransRecordId=0&AX_ReportContext=?RunOnClient%3D1%26PrintMediumType%3DScreen&AX_RdpPreProcessedId=5637144577&SalesInvoiceDS_isTaxInvoice=False&SalesInvoiceDS_TaxInvoiceItemType=Item&SalesInvoiceDS_CountryRegionISOCode=US&DocumentTitle=Invoice&DocumentTitleSequel:isnull=true&IdentificationText:isnull=true&InstanceType=Original&InvoiceInstanceText:isnull=true&CustInvoiceDuplicateRecId=0&UserName:isnull=true&SalesInvoiceDS_AgentAddress_TH:isnull=true&SalesInvoiceDS_AgentId_TH:isnull=true&SalesInvoiceDS_AgentName_TH:isnull=true&IsUnrealizedVATEnabled_TH=False&SalesInvoiceDS_Location=None&SalesInvoiceDS_MiscText:isnull=true&SalesInvoiceDS_PrintHeader:isnull=true&SalesInvoiceDS_ProdType=All&SalesInvoiceDS_TaxBranchCode_TH:isnull=true&SalesInvoiceDS_TaxBranchName_TH:isnull=true

What we do is:
Restart Reporting services – this step can be removed
Open internet explorer
Set IE window to be not visible
Navigate in SalesInvoice report with dummy parameters (here I pause the script for 3 minutes to make sure the report will finish rendering)
Close IE.

Stop-Service "SQL Server Reporting Services (MSSQLSERVER)"
Start-Service "SQL Server Reporting Services (MSSQLSERVER)"

# based on http://msdn.microsoft.com/en-us/library/ms155391.aspx)

[string] $url = "http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fDynamicsAX%2fStaticReports%2fen-US%2fSalesInvoice.Report&AX_PartitionKey=initial&AX_UserContext:isnull=true&AX_RenderingCulture=en-us&AX_CompanyName=CEU&FormLetterRecordId=0&PrintCopyOriginal=Original&RecordId=22565421785&LedgerJournalTransRecordId=0&AX_ReportContext=?RunOnClient%3D1%26PrintMediumType%3DScreen&AX_RdpPreProcessedId=5637144577&SalesInvoiceDS_isTaxInvoice=False&SalesInvoiceDS_TaxInvoiceItemType=Item&SalesInvoiceDS_CountryRegionISOCode=US&DocumentTitle=Invoice&DocumentTitleSequel:isnull=true&IdentificationText:isnull=true&InstanceType=Original&InvoiceInstanceText:isnull=true&CustInvoiceDuplicateRecId=0&UserName:isnull=true&SalesInvoiceDS_AgentAddress_TH:isnull=true&SalesInvoiceDS_AgentId_TH:isnull=true&SalesInvoiceDS_AgentName_TH:isnull=true&IsUnrealizedVATEnabled_TH=False&SalesInvoiceDS_Location=None&SalesInvoiceDS_MiscText:isnull=true&SalesInvoiceDS_PrintHeader:isnull=true&SalesInvoiceDS_ProdType=All&SalesInvoiceDS_TaxBranchCode_TH:isnull=true&SalesInvoiceDS_TaxBranchName_TH:isnull=true&rs:Command=Render";

#documentation of InternetExplorer.Application: http://msdn.microsoft.com/en-us/library/aa752084(v=vs.85).aspx

$ie = New-Object -comObject InternetExplorer.Application;
$ie.navigate2($url);
$ie.visible = $false;
# sleep for 3 minutes to make sure the call is properly completed
Start-Sleep -s 180;

$ie.Quit();

Thing to remember is in case of using static reports:http://technet.microsoft.com/en-us/library/hh496446.aspx
In this case we create directory StaticReports under DynamicsAx directory and there we have for each language separated report.
That makes reports better performed as we safe couple of trips to Metadata service as we do not run in this case AX rendering extension, but we have RDL ready to be run (see image below) but then if we want to warm up the report we have to make sure we warm up each language version we want to use. (ie http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fDynamicsAX%2fStaticReports%2fde-de%2fSalesInvoice.Report for German)
Read more...

Friday, June 20, 2014

Powering on a virtual machine in Workstation fails with the error: VMWare Workstation unrecoverable error: (vmx) (2032746)

0 comments

Powering on a virtual machine in Workstation fails with the error: VMWare Workstation unrecoverable error: (vmx) (2032746)

Symptoms

  • Cannot resume a suspended virtual machine in Workstation
  • Cannot power on a virtual machine in Workstation after a power failure
  • Powering on a virtual machine fails
  • You see the error:

    VMWare Workstation unrecoverable error: (vmx)
    Exception 0xc0000006 (disk error while paging) has occurred.

Cause

This issue occurs if the virtual machine suspended state file is corrupted.

Resolution

To resolve this error, you must remove the suspended state file.

Notes:
 To remove the suspended state file:
  1. Navigate to the folder where the virtual machine files are stored.
  2. Delete all files and folders that end with:

    • .lck
    • .vmss
  3. Edit the virtual machine configuration (.vmx) file. For more information, see   Tips for editing a .vmx file (1714).
  4. Locate the entry that begins with checkpoint.vmState.
  5. Remove everything between the quotation marks. For example, the entry should appear similar to:

    checkpoint.vmState = ""
  6. Save and close the .vmx file.
Note: Ensure to changes made to the file are appropriate and correct. Improper configuration of .vmx file may result in a virtual machine failure.
Read more...

Thursday, June 5, 2014

Troubleshooting issues during an installation of the Data Migration Framework

0 comments

Hi Tyo Lovers...

 In today's I will help you Troubleshooting Data Migration Framework.....

#Issue 1: Error with Windows Installer package
Setup will not install the Data Migration Framework service on a 64-bit computer without Microsoft Visual Studio 2010 installed and running.
The installation fails with the error "There is a problem with this Windows Installer package. A program required for this installation to complete could not be run. Contact your support personnel or package vendor."


ResolutionInstall the Microsoft Windows SDK for Windows 7 and .NET Framework 4 from
http://www.microsoft.com/en-us/download/details.aspx?id=8279.




On the Installation Options page, select the following options, and then complete the installation.
  • Under .NET Development, select Tools.
  • Under Redistributable Packages, select Microsoft Visual C++ 2010.
  • Open a command prompt with Run as administrator rights.
  • Depending on which version of SQL Server is in your environment, run one of the following commands.
    • For SQL Server 2012, run Command
      <System Drive>\Program Files\Microsoft SDKs\Windows\v7.1\bin\NETFX 4.0 Tools\gacutil.exe" -i "C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework Service (Beta)\Microsoft.Dynamics.AX.DMF.DMFErrorDescription.dll"
    • For SQL Server 2008, run Command
      <System Drive>\Program Files\Microsoft SDKs\Windows\v7.1\bin\gacutil.exe" -i "C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework Service (Beta)\Microsoft.Dynamics.AX.DMF.DMFErrorDescription.dll"
  • Start the Microsoft Dynamics AX 2012 Data Migration Framework service.
#Issues 2: Data Migration Framework will not compile
If after installing the Data Migration Framework, you cannot compile,
  • validate that the Data Migration Framework has installed correctly.
  • Verify that the Microsoft Dynamics AX Data Migration Framework Service is running.
  • Validate that the Data Migration Framework DLLs have been placed in the appropriate folders. The Data Migration Framework DLLs include:
    • Client DLLs
      Microsoft.Dynamics.AX.DMF.Mapper.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
      Microsoft.Dynamics.AX.DMF.PreviewGrid.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
      Microsoft.Dynamics.AX.DMF.ServiceProxy.dll – should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
      Microsoft.Dynamics.AX.DMF.DriverHelper.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
      Microsoft.Dynamics.AX.DMF.SSISHelper.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin
    • Server DLL


    • Microsoft.Dynamics.AX.DMF.SSISHelper.dll — should be present in the folder C:\Program Files\Microsoft Dynamics AX\60\Server\<AosInstance>\bin
      Microsoft.Dynamics.AX.DMF.ServiceProxy.dll – should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\<AosInstance>\Bin
      Microsoft.Dynamics.AX.DMF.DriverHelper.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\ Server\<AosInstance>\Bin
      Microsoft.Dynamics.AX.DMF. DMFErrorDescription.dll — should be present in the folder C:\Program Files (x86)\Microsoft Dynamics AX\60\ Server\<AosInstance>\Bin
Resolution
The following is how to proceed if the DLLs are not present for each installation type.

  1. For Installation type : Client
    Copy the DLLs from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework Client Components(Beta)) to the folder indicated.
  2. For Installation type : Server
  3. Copy the Microsoft.Dynamics.AX.DMF.SSISHelper.dll from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework Server Components(Beta)\ ) to the folder indicated.
Use the Assembly Registration Tool (Regasm.exe) to register the DLL. At a command line, run the following two commands:


  1. regasm Microsoft.Dynamics.AX.DMF.SSISHelper.dll /tlb: Microsoft.Dynamics.AX.DMF.SSISHelper.tlb
  2. regasm Microsoft.Dynamics.AX.DMF.ServiceProxy.dll /tlb: Microsoft.Dynamics.AX.DMF.ServiceProxy.tlb

Issue 3: Data Migration Framework service location changes
If you need to update the location where you are running Integration Services and the Data Migration Framework service, you can update the configuration information with correct computer name in the following files:
http://<<DMF Service ComputerName>>:7000/DMFService/DMFServiceHelper.svc


This file can be found in the following locations:
  1. For Client, C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\ Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config
  2. For Server, C:\Program Files\Microsoft Dynamics AX\60\ServerAosInstance\Bin\ Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config
  3. For Service, C:\Program Files\Microsoft Dynamics AX 2012 Data Migration Framework Service (Beta)\ Microsoft.Dynamics.AX.DMF.SSISHelperService.exe.config

 
Read more...

Tuesday, May 27, 2014

Configure Resource Pools, WorkLoad Group, and Classifier Function and then enable the Resource Governor

0 comments
To manage the server workload by restricting resource-intensive you need Configure Resource Pools, WorkLoad Group, and Classifier Function and then enable the Resource Governor
Read more...

Snapshot Replication

0 comments
Snapshot Replication to use the company runs a custom application that stores data in a large Microsoft SQL Server 2012 Database, the primary database is hosted in the main office. Each branch office SQL Server hosts a copy of the database, for a solution that will replicate the entire primary database from the main office SQL Server every weekend
Read more...

UPGRADE ADVISOR

0 comments
UPGRADE ADVISOR is a To evaluate to prepare for possible conflicts and issues that may arise during or after the migration with a new server and plan to migrate your database from SQL server 2008 to SQL Server 2012
Read more...

Monday, March 10, 2014

Using Controller Class in Developing SSRS Reports in Microsoft Dynamics AX 2012

0 comments

Overview

Controller class is used to control the report execution as well as preprocessing of the report data. The SSRS reporting framework uses this class to modify the report dialogs, calling the SQL Server reporting services, as well preprocessing parameters for the report.
Following are the scenarios where Controller class can be used:
  1. Modifying a report query based on the input data
  2. Modifying report contract data based on the input data
  3. Control a report parameters dialog
  4. Open different reports/designs from the same menu item based on the input data
  5. Reports that are opened from a form
To create a controller class, extend it with SrsReportRunController.

Prerequisites

  1. Microsoft Dynamics AX 2012
  2. Reporting services extensions must be installed in Dynamics AX

Sample Controller Class

  1. Create a new class. Open AOT → Classes
  2. Right Click on Classes and select New Class. Name it as SSRSDemoController.
example of creating a new class in Dynamics AX

  • Open the Class declaration by right clicking on it and selecting View code.
example of viewing code in AOT class AX

  • Now write the following code:
class SSRSDemoController extends SrsReportRunController

{

}
  • Create a new method and write the following code:
public static client void main(Args args)

{

//define the new object for controller class

SSRSDemoController ssrsDemoController;

ssrsDemoController = new SSRSDemoController();

//pass the caller args to the controller

ssrsDemoController.parmArgs(args);

//set the report name and report design to run

ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,Design));

//execute the report

ssrsDemoController.startOperation();

}

Examples of Controller Class Usage

Based on different scenarios, different methods are overridden as shown in the following examples:
  1. Modifying report query based on the input data

  • Used in those scenarios where a report query needs to be modified based on the caller args parameters or recorded before the report parameter dialog is rendered.
  • Override prePromptModifyContract method to modify the report query as shown below:
public void prePromptModifyContract()
{
    //add a range in the report query  
      SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(SSRSReportDemo),fieldNum(SSRSReportDemo, RecId),SysQuery::value(this.parmArgs().record().RecId));
}
Note: prePromptModifyContract is called by report controller before the parameter dialog is shown to the User.
  • Modifying report contract data based on the input data

  • Used in those scenarios where report contract parameters need to be modified based on the caller args prior to the execution of the report.
  • Override preRunModifyContract method to modify the report contract as shown below:
protected void preRunModifyContract()
{    
    //define object for report contract
    SSRSDemoContract contract;

    //get the reference of the current contract object
    contract = this.parmReportContract().parmRdpContract() as SSRSDemoContract;

    //modify the parameter value of the contract
    contract.parmType(this.parmArgs().parm()); 
}
Note: preRunModifyContract is called by report controller before the report is run.
  • Control report parameters dialog

  • In some scenarios, a report parameter dialog should not be visible to the end user. Controller class is also used to control the visibility of the report parameter UI.
  • Add the following code in the main method of the controller class before startOperation method call to hide/show the report parameter UI:
//hide the report parameter dialog
ssrsDemoController.parmShowDialog(false);
  • Open different reports from the same menu item based on the input data

  • It is used in those scenarios where different reports or different designs of a same report need to be opened from a same menu item depending upon the caller args.
  • Write the following code in main method to achieve this scenario:
public static client void main(Args args)
{    
    //define the new object for controller class
    SSRSDemoController ssrsDemoController;
   
    ssrsDemoController = new SSRSDemoController();
    
    //pass the caller args to the controller
    ssrsDemoController.parmArgs(args);
        
    //if report is run from edit mode then run the EditDesign of the report otherwise run the NewDesign of the report
    if(args.parmEnum() == FormOpenMode::ForEdit)
    {
        //set the report name and report design to run
        ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,EditDesign));    
    }
    else
    {
        //set the report name and report design to run
        ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,NewDesign));    
    }   
    
    //execute the report
    ssrsDemoController.startOperation();   
}
  • Reports that are opened from a form

  • Controller class is also used when reports are opened from a form and are needed to show selected record details.
  • Use either prePromptModifyContract method or preRunModifyContract method to achieve this scenario.
Read more...

Thursday, February 27, 2014

Creating a Matrix Report [AX 2012]

0 comments

In this walkthrough, you will create a report to display customer transaction data in a matrix data region. A matrix data region displays data in a two-dimensional grid of columns and rows that intersect at specific data points. When defining a matrix data region, you can specify column and row groupings. The data that appears in the detail cells are aggregates based on the intersections of columns and rows.
This walkthrough illustrates the following tasks:
  • Defining a query
  • Creating a reporting project
  • Creating a report with a matrix data region
To complete this walkthrough, you will need:
  • Microsoft Dynamics AX with sample data
    NoteNote
    This walkthrough uses the CustTable, CustTrans, and CustGroup tables. In order to view data in the report, these tables must contain data.
  • Microsoft Visual Studio 2010
  • Microsoft Dynamics AX tools for Microsoft Visual Studio
There are several ways to retrieve data for reports. In this walkthrough, you will use a query that is defined in the Microsoft Dynamics AX development workspace. The following procedure explains how to define the query that will be used to retrieve customer transaction data.

To define a query

  1. In the Microsoft Dynamics AX development workspace, open the AOT.
  2. In the AOT, right-click the Queries node, and then click New Query.
  3. Right-click the node for the query, click Rename, and then type CustTransactions.
  4. Expand the CustTransactions query.
  5. In the AOT, right-click the Data Dictionary node, and then click Open New Window.
  6. In the new window, expand the Tables node.
  7. Locate the CustTable table and drag it onto the Data Sources node for the query.
  8. Expand the node for the CustTable_1 data source.
  9. Select the Fields node, in the Properties window, set the Dynamic property to Yes.
  10. Locate the CustTrans table and drag it onto the Data Sources node located within the CustTable_1 data source.
  11. Expand the node for the CustTrans_1 data source.
  12. Select the Fields node, in the Properties window, set the Dynamic property to Yes.
  13. Locate the CustGroup table and drag it onto the Data Sources node located within the CustTrans_1 data source. This will be three levels down the hierarchy.
  14. Expand the node for the CustGroup_1 data source.
  15. Select the Fields node, in the Properties window, set the Dynamic property to Yes.
  16. Right-click the Relations node for the CustTrans_1 data source, and then click New Relation.
  17. Select the node for the relation and specify the following values in the Properties window.
    Property
    Value
    JoinDataSource
    CustTable_1
    Field
    AccountNum
    Related Field
    AccountNum
  18. Expand the node for the CustGroup_1 data source.
  19. Right-click the Relations node for the CustGroup data source, and then click New Relation.
  20. Select the node for the relation and specify the following values in the Properties window.
    Property
    Value
    JoinDataSource
    CustTable_1
    Field
    CustGroup
    Related Field
    CustGroup
  21. Save the query.
Next, you will create a reporting project. In this walkthrough, you will use the Report Model template. This will give you access to several predefined layout and style templates that you will use to define the layout of your reports. These templates are the standard templates for Microsoft Dynamics AX reports.

To create a reporting project

  1. Open Microsoft Visual Studio.
  2. On the File menu, point to New and then click Project. The New Project dialog box is displayed.
  3. In the Installed Templates pane, click the Microsoft Dynamics AX node. In the Templates pane, click Report Model.
  4. In the Name box, type SampleMatrixReport, and in the Location box, type a location.
  5. Click OK.
Next, in the reporting project, you will create a report that displays customer transaction data in a matrix data region. You will define a column grouping based on the TransDate field and two row groupings based on the Name and AccountNum fields. The following procedure explains how to create the report.

To create a report with a matrix data region

  1. In Solution Explorer, right-click the project, point to Add, and then click Report.
  2. In Model Editor, right-click the Report1 node and then click Rename.
  3. Type SampleMatrixReport as the name.
  4. Right-click the Datasets node for the report, and then click Add Dataset.
  5. Select the node for the dataset.
  6. In the Properties window, specify the following property values.
    Property
    Value
    Data Source
    Dynamics AX
    Data Source Type
    Query
    Default Layout
    Matrix
    Name
    CustTransactions
    Query
    1. Click the ellipsis button (…). A dialog box displays where you can select a query that is defined in the AOT and identify the fields that you want to use.
    2. Select the CustTransactions query and then click Next.
    3. Expand the All Fields node for CustTable.
    4. Select the AccountNum field from the CustTable table.
    5. Expand the CustTrans > All Fields node, select the AmountMST and TransDate fields from the CustTrans table.
    6. Expand the CustGroup > All Fields node, select the Name field from the CustGroup table.
    7. Click OK to save the field selection.
    The Query field is now
    SELECT CustTable.1.AccountNum,CustTrans.1.TransDate,CustTrans.1.AmountMST,CustGroup.1.Name FROM CustTransactions
  7. In Model Editor, select the Datasets > CustTransactions > Fields > AmountMST node.
  8. In the Properties window, set the Aggregate Function property to Sum and set the Format String property to Currency.
  9. In Model Editor, drag the CustTransactions node onto the Designs node. An auto design named AutoDesign1 is created for the report.
  10. Expand the AutoDesign1 node, expand the node for the matrix data region, and then expand the Data node.
  11. Drag the TransDate field from the Data node onto the Column Groupings node.
  12. Select the TransDate node.
  13. In the Properties window, type the expression =Year(Fields!TransDate.Value) for the Label property.
  14. In Model Editor, expand the TransDate node, expand the Group on node, and then select the TransDate node that is located below the Group on node.
  15. In the Properties window, type the expression =Year(Fields!TransDate.Value) for the Expression property.
  16. In Model Editor, drag the Name field from the Data node onto the Row Groupings node.
  17. Select the Name node.
  18. In the Properties window, set the Display Width property to 1in and set the Display Subtotals property to False.
  19. In Model Editor, drag the AccountNum field from the Data node onto the Row Groupings node.
  20. Select the AccountNum node.
  21. In the Properties window, set the Display Width property to 1in and set the Display Subtotals property to False.
  22. In Model Editor, select the AmountMST node that is located below the Data node.
  23. In the Properties window, set the Display Width property to 1in, and set the Text Align property to Right.

To apply layout and style templates

  1. In Model Editor, select the AutoDesign1 node.
  2. In the Properties window, set the Layout Template property to ReportLayoutStyleTemplate. Also, type Customer transactions for the Title property.
  3. In Model Editor, expand the AutoDesign1 node, and then select the CustTransactionMatrix node.
  4. In the Properties window, set the Style Template property to MatrixStyleTemplate. Also, delete the default text for the Title property so that it does not display a title for the data region.
  5. In Model Editor, right-click the AutoDesign1 node, and then click Preview. Click the Report tab to see the report. The report displays a list of customer transactions with customer groups down the left side and years across the top.
  6. Close the Preview window.
Read more...

Sunday, February 23, 2014

This virtual machine appears to be in use .vmdk - how to resolve?

0 comments

Issue :-
This virtual machine appears to be in use.  If this virtual machine is already in use, press the "Cancel" button to avoid damaging it. If this virtual machine is not in use, press the "Take Ownership" button to obtain ownership of it.

Solution :-
you will have .lck folders in the directory where you will have the .vmdk file. Delete them and try again. 
 
real work....!!!!
Read more...

Friday, February 14, 2014

Tips & Tricks around debugging X++ code in Dynamics AX

0 comments
When you are developing X++ code for Dynamics AX over the time you will for sure run into a situation where the below Tips & Tricks can make your debugging live easier. The information are no secrets it is just hard finding them the very first time you need them. Since I was also once in the situation needing to find them, I thought it is maybe a good idea to collect the most useful ones I'm using day to day...

The most oblivious one: Interrupting the code execution
When you have written some code that is causing an endless loop (or a very long execution) and you want to know what code is currently keeping the client busy the easiest way is pressing [Ctrl] + [Break] on the keyboard.
This will stop the code execution and show up a message box: Are you sure that you want to cancel this operation?
If you hold down the [Shift] button on the keyboard while you click at the No button of the message box, the AX Debugger will be launched exactly at the line of code that was about to be executed. From here you can continue to step over / into line by line and try to identify the cause of your endless loop.

The breakpoint is sometimes not hit?
Sometimes it happens that a breakpoint is not hit although you are sure the respective code was executed. For example if you want to debug code behind User Controls like Form buttons this can happen.
Here instead of putting a breakpoint at a line of code insert the breakpoint keyword.
public void executeQuery()
{
   ;
   breakpoint;   super();
}
Please note that using breakpoint has a serious side effect:
The breakpoint will be hit by all user sessions! This is definitely something you
don't want to do in a live environment.

How can I see the call stack that resulted in a X++ exception?
When you run into an exception that is showing up in the InfoLog usually double clicking at the error brings you to the line of code where the error was raised.
Sometimes knowing the line of code where the error was raised is however not good enough as the individual call stack is what you need to know. Putting a breakpoint at the line of code where the exception was raised is helpful, what however if you are in a loop and you don't know what loop iteration results in the error especially if the error is random?
Instead of putting the breakpoint at the line of code where the exception might be raised, put a breakpoint in the add method of the Info class, e. g. at the line switch (logLevel).
Exception add(
   // ...
   ;
   switch (logLevel)
   // ...
Info::add is always called when something is written to the InfoLog and since an exception shows up in the InfoLog as soon as the exception was raised the Info::add method is called and here you will hit your breakpoint.

How can I get the current X++ call stack?
The static method xppCallStack() of the xSession Kernel class returns the current X++ call stack:
   //...
   Info(con2str( xSession::xppCallStack() ));
   //...
The function funcname() returns the name of the method where it has been called.
public void executeQuery()
{
   ;
   Info( funcname() ); //In this case "executeQuery" will show up in the InfoLog

   super();
}

How can I see the SQL query that the Dynamics AX Kernel is generating for my Form?
When you are debugging your solution you sometimes might want to see the SQL Query the Dynamics AX Kernel has generated for your Form. While you can of course trace this directly at your Database Server, you also can do this in X++ using the QueryBuildDataSource class.
Let's imagine you have a Form that has PurchTable as Data Source. You have to override the executeQuery method of the PurchTable Data Source and add the following code:
public void executeQuery()
{
   Query q;
   QueryBuildDataSource qbds;
   ;
   q = this.query();
   qbds = q.dataSourceName("PurchTable"); //Replace with the current Table
   info( qbds.toString() );

   super();
}
Read more...

Thursday, February 6, 2014

Create Primary Key at AX 2012

0 comments

At The Properties Index > AllowDuplicates change NO.
Read more...

A financial dimension value is based on the LAND-00013 record and has been used on a transaction. You cannot delete the LAND-00013 record AX 2012

 A financial dimension value is based on the LAND-00013 record and has been used on a  transaction. You cannot delete the LAND-00013 record ...