Total Pageviews

Search This Blog

Thursday, January 31, 2008

Some AX Kernel functions

Thanks to Ruslan for this link:

http://schunk.dk/DocWeb/kernel%20functions.html

Wednesday, January 30, 2008

Structuring the first installer

Here, we will build a simple installer which will install a very simple application which consists of an executable, a DLL Library and a user manual. These files will be copied to a specific directory and 2 shortcuts would appear, one in usual place in the Start Menu and other icon shortcut on the Desktop.

Let’s start by following these steps:
a. Writing a simple .wxs xml installer source code .
b. Compiling the source code
c. Building the MSI.

OCC Contd...Concurrency Model configuration

Administration/Setup/System/Concurrency Model Configuration

This is a new feature in Dynamics AX 4.0 to set global concurreny model for database changes. The settings can siginificanly affect database performance.

Global Concurrency Settings
Optimistic concurrency mode enabled per table
This setting, which is the default, enables individual tables to be configured to work under a specific concurrency mode. When this option is selected, the concurrency mode is initially set to optimistic concurrency for all tables, with a few exceptions. The table property OccEnabled can be changed for any table as appropriate.

Optimistic concurrency mode enabled globally
Enables optimistic concurrency mode for all tables.

Pessimistic concurrency mode enabled globally
Enables pessimistic concurrency mode for all tables.

Use the READ UNCOMMITTED transaction isolation level for all Microsoft SQL Server 2000 database reads - Can be used to reduce blocking for installations running on Microsoft SQL Server 2000 databases.
Log all UPDATE conflict exceptions
Writes all UPDATE conflict exceptions to the log. It's recommended to select this setting.

Wix Introduction and Features

WiX (Windows Installer XML) is a toolset that builds Windows Installation Packages from XML Source Code. It provides a command-line environment that developers may integrate into their build processes to build MSI (Microsoft Installer) packages. WiX is an open source project. This toolset is written in C#.

Pre-Requisites
.NET Framework (Required on Developer’s system).
WiX Binaries and SDK(Required on Developer’s system).


Note: The installation packages built with this toolset do not require any software to be installed on the target computer.

Features
Features and advantages of the toolset:
· Declarative approach
· Unrestricted access to Windows Installer functionality
· Source code instead of GUI-based assembly of information
· Complete integration into application build processes
· Possible integration with application development
· Support for team development, both in-house and third-party
· Free, open source

Dynamic Property on Query's DataSource Fields

1. Go to AOT/Queries
2. For e.g. AssetBudgetModel\DataSources\Assetbudget\fields click the data source right-click Fields, and then click Properties.
2. Set the Dynamic property to No.


Note
By default, the Dynamic property is set to Yes and returns all fields from the table, map, or view. This makes maintenance easier because you don't need to change the query if a field is changed in the underlying data source. However, restricting the fields returned by the query is better for performance because unused data is not returned to the client each time the query is run.

Tuesday, January 29, 2008

X++ code for listing Projects from AOT


How to invoke .NET Assembly from SQL Server 2005

Steps

1. Write a C# assembly which will have a simple method called "HelloWorld" which will take a string as argument and will return the string concatenated with "Hello".

2. Build the assembly

3. Open SQL Query Analyzer and


CREATE ASSEMBLY asmHelloWorldSQL FROM 'c:\HelloWorldSQLAssembly.dll'

Note: asmHelloWorldSQL is name of assembly which can be anything and we have to pass the path where the assembly resides

4. Create a function which will reference the assembly we created


CREATE FUNCTION dbo.clrHelloWorld
(
@name as nvarchar(200)
)
RETURNS nvarchar(200)
AS EXTERNAL NAME [asmHelloWorldSQL].[HelloWorldSQLAssembly.Class1].[HelloWorld]

Note: This function will invoke the HelloWorld method from the assembly and return the string.

5. SELECT dbo.clrHelloWorld('Invoke from SQL 2005')
and,
this will return

"Hello Invoke from SQL 2005"

Happy assembling :-)

Configure CLR option in SQL Server

This problem comes when you try to execute assembly method from SQL.

Error:

/**
Msg 6263, Level 16, State 1, Line 1
Execution of user code in the .NET Framework is disabled. Enable "clr enabled" configuration option.
**/

Solution:

EXEC sp_configure 'clr enabled', 1
RECONFIGURE WITH OVERRIDE
GO

Tools - Addins - Source Code TitleCase Update

This is a handy option which will do proper case updation for class and method names. This is especially useful when you have long list of methods for your class and you need to update them with proper titlecase.

e.g. Go to AOT-> and then switch to the context menu->Addins->SourceCodeTitlecase update


Once it is run, it will list an infolog with the changes which are done to the code.




X++ code to find unique index/primary keys for any table

This X++ code iterates through any table and lists the unique index. Note that a format is being assigned in the loop. This is done to meet our customization.

SQL Server 2008 pushed to Q3 2008

http://searchwinit.techtarget.com/news/article/0,289142,sid1_gci1295958,00.html?track=NL-118&ad=622308&asrc=EM_NLN_2958542&uid=6014021

Friday, January 25, 2008

Complex query expressions

Filter the records on customer form based on Group or Currency

In init() method of Custtable datasource, put the following code:

CustTable_ds.query().dataSourceNo(1).addRange(fieldnum(Custtable,custgroup)).value(strFmt('((CustGroup=="%1") (Currency=="%2"))',queryvalue("50"),queryvalue("EUR")));

In the value part, we can have OR expression i.e. ((CustGroup=="%1") (Currency=="%2"))
and then the actual values supplied at the end.

Tuesday, January 22, 2008

Dynamics Axapta and OCC (Optimistic Concurreny Control)

Definition

Optimistic Concurrency Control (OCC) helps increase database performance. Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update. However, Optimistic Concurrency only locks records from the time when the actual update is performed.

Pessimistic concurrency was the only option available in Microsoft Axapta 3.0 (now a part of Microsoft Dynamics). You can now choose which concurrency model to use—optimistic or pessimistic.

Advantages

  • Fewer resources are used to hold the locks during the update process.
  • Records are locked for a shorter length of time.
  • Records remain available for other processes to update if they have been selected from the database but haven't yet been updated.

Disadvantages

The disadvantage of using OCC is that the update can fail if another process updates the same record. If the update fails, it must be retried. This can lead to a reduction in database performance.

How to catch Update Conflicts

Update Conflicts can be handled by catching the UpdateConflict and UpdateConflictNotRecovered events.

This pattern is used across AX API's for retrying the update conflicts and if it exceeds the maximum retry count then UpdateConflictNotRecovered exception is thrown.

e.g. AOT\Classes\PurchTableType\delete

Update Conflicts and recversion field

Update conflicts are detected by the kernel. It checks the value of the recVersion system field on the table at the time the record is selected for update. This value is matched to the value of the field when the record is subsequently updated. The default value of recVersion is 1. This is changed to a random value when a record is updated.

Links
http://msdn2.microsoft.com/en-us/library/ms378709.aspx
http://msdn2.microsoft.com/en-us/library/bb190073.aspx

Dynamics AX 4.0 Enterprise portal website

There's a great website built using Enterprise portal capabilities of Dynamics Axapta 4.0. Really good piece of work done

Site: www.itvertigo.com

See the thread below for more details:

http://groups.google.com/group/microsoft.public.axapta.programming/browse_thread/thread/127b0f7b7f68163f/27e9c34befeb1ba3#27e9c34befeb1ba3

Monday, January 21, 2008

Database Logging Setup






Database Logging Wizard enables to setup the tables against which modifications has to be logged.






Administration->Setup->Database Log






































































Friday, January 4, 2008

AX Strange Errors

Today, when I started AX, I got some strange errors each time like:


Object Server 01: Dialog issued for client-less session 1: Error executing code: SysCheckList_Setup object does not have method 'isSetupMode'.
Stack trace
(S)\Classes\SysCheckList_Setup\isSetupMode
(S)\Classes\Application\isRunningMode - line 5
(S)\Classes\Application\dbSynchronize - line 12
(S)\Classes\Application\syncApplTables - line 5
(S)\Classes\Application\new - line 6


Object Server 01: Dialog issued for client-less session 1: Error executing code: object does not have method 'main'.
Stack trace
(S)\Classes\\main


Object Server 01: I/O Error 38 (OS error ) occured when session 3 accessed E:\Program Files\Microsoft Dynamics AX\40\Application\appl\standard\axapd.aoi. User chose to retry.

Solution:

Stopped AOS Service
Deleted axapd.aoi file in application folder
Restart AOS Service
Start AX