Tuesday, February 28, 2017

Iterate Container

Static void IterateContainer(Args _args)
{
            Container colors = ["Black", "White", "Red"];
            int        count;
           
            for(count=1; count <= conlen(colors); count++)
            {
                 info(strfmt("%1 - Color: %2", count, conpeek(colors,count)));
            }
}   

Tuesday, July 26, 2016

Import Contoso Demo Data to Dynamics AX 2012

For AX 2012 demo data is available at partner source Link (Partner or customer source login required).

Now, demo data is available in executable file DynamicsAX2012R3DemoData.exe.

To import demo data,
Microsoft Dynamics AX 2012 Test Data Transfer Tool is required Link (Partner or customer source login required).

If above link does not work to download tool, login to Dynamics LCS & look for Downloadable tools as below.


 

If above both is available follow steps below to import data.
It is recommended that you follow below process on DB Server.

Step 1:
Extract the demo data files from DynamicsAX2012R3DemoData.exe to a specific location.
Note:
It is suggested that extract it to database server local drive – for better performance.
Also make sure that at least 40GB Space is available.

The output folder will contain the files of following extension types:
1.                  .OUT - data file that contains metadata for AX transactional database
2.                  .OutModel - data file that contain metadata for AX model database
3.                  .XML - data file that contains AX table data.

Step 2:
 Run the Test Data Transfer Tool.exe file to install the utility. Note path where this tool gets installed. 
 

After successful installation, the folder will look like as shown below:

Step 3:
Open AX client and import the .XPO named (MetaDataXMLGenerator.Xpo) from the path you have installed Test Data Transfer Tool.

On successful import a job will be created as shown below:

Step 4:
Run the job <MetadataXMLGenerator(usr)>, a  meta data file will be generated. Path will be displayed in the infolog after job execution completes as shown in the snapshot below:
If you lost Infolog, open Run and type %temp%, there you get Metadata.xml

Step 5:
Copy the metadata file from the above path and paste it in [lists] folder (where Test Data Transfer Tool has been installed- Step 2). Overwrite the file already exists.

Step 6:
Stop MS Dynamics AX service.

Step 7:
Open command prompt using administrator and navigate to the path where the Test Data Transfer Tool is installed. This must be installed on Database server to avoid errors.

Step 8:
Run the following command:
Dp.exe Import “C:\R3DemoData\DynamicsAXR3DemoData” DAX2012R3 “Contoso\SQL2012”
i.e.
C:\R3DemoData\DynamicsAXR3DemoData: update the path (Demo Data extracted path)
DAX2012R3: update the database name. (AX Business Database Name)
Contoso\SQL2012: SQL Server Instance name, where database is attached.

If you do not specify [Server], it will always looking for current machine.

In case of standalone you will get the following screen after execution of above command.


If we enter ‘Y’, then following screen will open up describing the count for importing the table data and Error (if they come up)


The process may take time depending upon machine configuration.
At the end,
On successful import, Open AX client and data will show up.
Also, you may notice some errors count, you can review that error from DPLog file from installation folder as below.

 

Troubleshoot the issue related to this tool: (Good comments are posted with errors and resolutions).

Wednesday, January 6, 2016

Dynamics AX Demo Solutions and License files.

Are you searching for Demo Solutions for Dynamics AX.

Below mentioned link can help you.

AX Demo solution and license file - Link  (requires partner source login).


Demo license file is being updated by MS team yearly, which will be used for Dynamics AX AOS.



Tuesday, September 22, 2015

"TypeId" in Microsoft Dynamics AX 2012

In Microsoft Dynamics AX 2012 and onwards, 
"TypeId" function has been replaced by ExtendedTypeStr or EnumStr.

ExtendedTypeStr(EDT  _EDT) : for Extendet Data Type (EDT) with non Enum Type.
EnumStr(Enum  _Enum): for Base Enum and for Extendet Data Type (EDT) with Enum Type.

Friday, March 6, 2015

Error unable to compile "xxx,xx+xx,xx"

Today I got weird error to solve, which shows error message Unable to compile "100,00+12,00".


While opening TAX form from Purchase line this error occurred as below.


Actually, the culprit was function evalbuf, which is part of AX framework.

This function evaluates formula string. The limitation of this function is that we must use "." as decimal separator in formula string.

In our case the decimal separator was "," so evalbuf was throwing error "unable to compile" with expression passed as shown in above image.


To solve error, I have used strReplace function from global class which replaces "," to "." in the formula string.

Wednesday, March 4, 2015

Error "An unexpected error has occurred while opening the workflow. See the event log on the AOS and contact your system administrator to resolve the issue" on creating the workflow.

To resolve mentioned error we have following options.

Solution 1:
Do incremental CIL compile.

Not succeeded?!

Solution 2:
Do full CIL compile.

Still not succeeded?!

Solution 3:

Stop AOS service.

Rename XppIL folder to XppIL_old. form the following location.
<Drive letter>:\Program Files\Microsoft Dynamics AX\60\Server\<Instance Name>\bin

Start AOS service.

Do full CIL compilation.

Now your face should be filled with SMILE :)

Have any question?! Please comment.

Tuesday, January 20, 2015

Caching Display Methods in Microsoft Dynamics AX

The performance of display methods can be improved by caching mechanism.

This must be used while methods are of following nature.
1) Used for complex calculations.
2) Returning large string data.
3) Display image data.

How To:

Option 1:
  • On the form expand the Data Sources node.
  • Override init method.
  • Call formDataSource.cacheAddMethod() after super() in the init method.
  • First parameter determines name of method 
  • Second parameter is boolean, which indicates that whether the value of display method is updated when record is written to the database.
Public void init()
{
super();
this.cacheAddMethod(
tablemethodstr(<table>,<display method>),                                       [_updateOnWrite]
); 

}

Option 2:
  • Use "SysClientCacheDataMethodAttribute" attribute in display method declaration.
[SysClientCacheDataMethodAttribute ([_updateOnWrite])]
display <ReturnType> methodName(){....}




Option 3:
  • Set form control property CacheDataMethod to “Yes” on the form. This option is available for methods which are created at table level.

Note:
The value of all cached methods is set when data is fetched from the back-end database. In addition, the value is refreshed when the reread method is called on the form data source.

All the above options are supported with AX 2012 R2 & R3, for AX 2009 only first option is available.