Number sequences

August 13, 2008

Number sequences

Number sequences in Axapta are a mechanism
for generating unique numbers. These are generally used as a unique Id to
identify a table record.

Every number sequence is
linked to an ExtendedDataType inside Axapta. Therefore you will need to create
separate datatypes for each number sequence which will be created.

Contents


*
1 Adding a number sequence

*
1.1 Add an element to the NumberSeqModule base enum

*
1.2 Extend the NumberSeqReference class

*
1.3 Create a parameters table and form

*
2 Calling a number sequence

Adding a number sequence

You may wish to use one or
more new number sequences when you create your own module inside Axapta.

The steps to add your own
number sequence to Axapta are fairly straight-forward, but lengthy. The
following description is based on the Axapta best-practice methodologies.

For this example, we will
add one new number sequence called NSId for a new module called NS. This
assumes that an ExtendedDataType called NSId already exists.

If not using an existing
extended datatype, create a new string EDT, which extends datatype ‘num’. Note
that in Ax 3.0 this num is a string field, length of 20.

Add an element to the NumberSeqModule base enum

One element should be added
to the enum for your module, irrespective of the number of actual number
sequences which will be created.

Therefore we modify the
NumberSeqModule enum and add the element NS.

Extend the NumberSeqReference class

Create a new sub-class of
NumberSeqReference and implement the numberSeqModule() and loadModule()
methods. Use an existing sub-class as a template to assist with this. This is
shown below.

public class NumberSeqReference_NS extends NumberSeqReference

{

}

/*

Detailed description of how to setup
references for number sequences can

be found i method loadModule() on the
‘father’ class: numberSeqReference.

*/

protected void loadModule()

{


NumberSequenceReference numRef;


;

// Setup Job TransId


numRef.dataTypeId =
typeid2extendedtypeid(typeid(NSId));


numRef.referenceHelp =
“Some description
here”
;


numref.WizardContinuous =
false;


numRef.WizardManual =
NoYes::No;


numRef.WizardAllowChangeDown =
NoYes::No;


numRef.WizardAllowChangeUp =
NoYes::No;


numRef.sortField = 1;


this.create(numRef);

}

public static NumberSeqModule numberSeqModule()

{

return NumberSeqModule::NS;

}

In addition, you must
modify the construct() and moduleList() methods on NumberSeqReference itself to
add references to your new module class. Note the sections of code surrounded
by //— NS Begin and //— NS End

static public container
moduleList()

{

container moduleList;


;


moduleList += NumberSeqReference_Bank::numberSeqModule();


moduleList += NumberSeqReference_BOM::numberSeqModule();


moduleList += NumberSeqReference_Customer::numberSeqModule();


moduleList += NumberSeqReference_Document::numberSeqModule();


moduleList += NumberSeqReference_ForeignTrade::numberSeqModule();


moduleList += NumberSeqReference_General::numberSeqModule();


moduleList += NumberSeqReference_Inventory::numberSeqModule();


moduleList += NumberSeqReference_Ledger::numberSeqModule();


moduleList += NumberSeqReference_Location::numberSeqModule();


moduleList += NumberSeqReference_MasterPlanning::numberSeqModule();


moduleList += NumberSeqReference_Production::numberSeqModule();


moduleList += NumberSeqReference_Project::numberSeqModule();


moduleList += NumberSeqReference_PurchaseOrder::numberSeqModule();


moduleList += NumberSeqReference_Route::numberSeqModule();


moduleList += NumberSeqReference_SalesOrder::numberSeqModule();


moduleList += NumberSeqReference_Tax::numberSeqModule();


moduleList += NumberSeqReference_Vendor::numberSeqModule();


moduleList += NumberSeqReference_Internet::numberSeqModule();


moduleList += NumberSeqReference_Asset::numberSeqModule();

//— HRM Begin


moduleList += NumberSeqReference_HRM::numberSeqModule();


moduleList += NumberSeqReference_KnowledgeCollector::numberSeqModule();


moduleList += NumberSeqReference_VirtualNetwork::numberSeqModule();

//— HRM End

//— CRM Begin


moduleList += NumberSeqReference_CRM::numberSeqModule();

//— CRM End

//— SFC Begin


moduleList += NumberSeqReference_JobManager::numberSeqModule();

//— SFC End

//— NS Begin


moduleList += NumberSeqReference_NS::numberSeqModule();

//— NS End

return moduleList;

}

public static numberSeqReference construct(NumberSeqModule _module)

{

switch (_module)

{


case (NumberSeqReference_Ledger::numberSeqModule()) : return new NumberSeqReference_Ledger(_module);


case (NumberSeqReference_Tax::numberSeqModule()) : return new NumberSeqReference_Tax(_module);


case (NumberSeqReference_Bank::numberSeqModule()) : return new NumberSeqReference_Bank(_module);


case (NumberSeqReference_SalesOrder::numberSeqModule()) : return new NumberSeqReference_SalesOrder(_module);


case (NumberSeqReference_ForeignTrade::numberSeqModule()) : return new NumberSeqReference_ForeignTrade(_module);

case (NumberSeqReference_Customer::numberSeqModule()) : return new NumberSeqReference_Customer(_module);


case (NumberSeqReference_PurchaseOrder::numberSeqModule())
:
return new NumberSeqReference_PurchaseOrder(_module);


case (NumberSeqReference_Vendor::numberSeqModule()) : return new NumberSeqReference_Vendor(_module);


case (NumberSeqReference_Inventory::numberSeqModule()) : return new NumberSeqReference_Inventory(_module);


case (NumberSeqReference_BOM::numberSeqModule()) : return new NumberSeqReference_BOM(_module);


case (NumberSeqReference_Route::numberSeqModule()) : return new NumberSeqReference_Route(_module);


case (NumberSeqReference_Production::numberSeqModule()) : return new NumberSeqReference_Production(_module);


case (NumberSeqReference_MasterPlanning::numberSeqModule()) :
return new NumberSeqReference_MasterPlanning(_module);


case (NumberSeqReference_Project::numberSeqModule()) : return new NumberSeqReference_Project(_module);


case (NumberSeqReference_Location::numberSeqModule()) : return new NumberSeqReference_Location(_module);


case (NumberSeqReference_Document::numberSeqModule()) : return new NumberSeqReference_Document(_module);


case (NumberSeqReference_General::numberSeqModule()) : return new NumberSeqReference_General(_module);


case (NumberSeqReference_Internet::numberSeqModule()) : return new NumberSeqReference_Internet(_module);


case (NumberSeqReference_Asset::numberSeqModule()) : return new NumberSeqReference_Asset(_module);


//
CC begin


case (NumberSeqReference_HRM::numberSeqModule()) : return new NumberSeqReference_HRM(_module);


case (NumberSeqReference_VirtualNetwork::numberSeqModule()) : return new NumberSeqReference_VirtualNetwork(_module);


case (NumberSeqReference_KnowledgeCollector::numberSeqModule())
:
return new NumberSeqReference_KnowledgeCollector(_module);


//
CC end


//
Shop Floor Control begin


case (NumberSeqReference_JobManager::numberSeqModule()) : return new NumberSeqReference_JobManager(_module);


//
Shop Floor Control end


//
CRM addition begin


case (NumberSeqReference_CRM::numberSeqModule()) : return new NumberSeqReference_CRM(_module);


//
CRM addition end


//
Product Builder addition begin

case (NumberSeqReference_PBA::numberSeqModule()) : return new NumberSeqReference_PBA(_module);


//
Product Builder addition end


//
NS begin


case (NumberSeqReference_NS::numberSeqModule()) : return new NumberSeqReference_NS(_module);


//
NS end

}


throw error(strFmt(
“@SYS53742”));

}

Create a parameters table and form

You should create a parameters table and form for
your new module. The easiest way is generally to duplicate an existing
Parameters table and modify it as required.

The important elements on
the new parameter table are the numberSeqModule() and numberSeqReference()
methods.

client server static
NumberSeqModule numberSeqModule()

{

return NumberSeqReference_NS::numberSeqModule();

}

client server static
NumberSeqReference numberSeqReference()

{

return NumberSeqReference::construct(NSParameters::numberSeqModule());

}

In the parameters form, you
must ensure that the code in the numberSeqPreInit(), numberSeqPostInit() and
NumberSequenceType.executeQuery() methods correctly reflect your new number
sequence elements.

Calling a number sequence

The following code gets a
number from the number sequence setting for EDT CustAccount

static void Job1(Args _args)

{


ExtendedTypeId id = TypeID2ExtendedTypeId(TypeId(CustAccount));


NumberSeq num = NumberSeq::newGetNum(NumberSequenceReference::find(id));


;


info(num.num());

}

Advertisements

Upgrade from AX 3.0 to AX 2009

August 1, 2008

This topic lists the high-level steps involved in upgrading from Microsoft Dynamics AX 3.0 to Microsoft Dynamics AX 2009.

  1. Back up your existing database and application files.
  2. Import two .xpo files from the installation media to assist with data upgrade.
    • UpgradeColumnList.xpo, for 32-bit to 64-bit RecId field conversion.
    • LeftJustified.xpo, for removing any trailing spaces from fields.
      • Note: To help improve performance, you can apply the
        LeftJustified.xpo on the database that you create in step 4 after
        you’ve used the Microsoft Dynamics AX DB Upgrade Preparation tool but
        before you start the Microsoft Dynamics AX 2009 AOS. See step 8.
  3. (Optional) To help improve performance, remove all user data and
    logs of Microsoft Dynamics AX 3.0. For example, clean up the
    SysDatabaseLog table.
  4. Create an empty database for Microsoft Dynamics AX 2009 in SQL Server 2005.
  5. (Optional) To help improve performance, set initial data and log
    file sizes so that they don’t increase while you perform the data
    upgrade process.
  6. (Optional) To help improve performance, set the recovery model to Simple for the Microsoft Dynamics AX 2009 Database.
  7. Run AXDBUpgrade.exe (The Microsoft Dynamics AX DB Upgrade
    Preparation tool). Note: To help improve performance, you can run this
    tool in Multithreaded mode. For example, to run this tool in 10
    threads, enter AxDbUpgrade.exe P/10 at a command prompt.
  8. (Optional) Apply the LeftJustify file imported in step 2 to the Microsoft Dynamics AX 2009 database created in step 4.
  9. Back up your Microsoft Dynamics AX database. Your database is ready to be upgraded.
  10. Run the Microsoft Dynamics AX 2009 Setup file from the installation
    media. During installation, select the database that you created in
    step 4.
  11. Copy your upgraded customized file into the correct application directory.
  12. Start the AOS.
  13. Start the Microsoft Dynamics AX 2009 client. The Upgrade checklist is displayed automatically.
  14. Complete the steps in the Upgrade checklist to finish upgrading.

Ax Database Configuration Checklist Part 2

July 24, 2008

Tempdb database storage configuration

q Determine total size of data and transaction log required for tempdb to avoid autogrow, and number of data files required based on # of processors (logical or physical).

How:

Determine the number of processors exposed to SQL Server. Unless you are using an affinity mask (not covered here), this is the total number of processors you see in the Windows Task Manager Performance tab.

Why:

SQL Server creates one visible scheduler (for processing user requests) for each processor, and we generally want to maintain one tempdb data file per processor. This recommendation is based on performance testing on the Dynamics AX OLTP workload.

Read the rest of this entry »


Ax Database Configuration Checklist part 1

July 24, 2008

Welcome to the Dynamics Ax Performance Team’s blog.  We’re putting together a team introduction and hope to have it posted within the next week or so.  The first entries will discuss SQL Server 2005 configuration and Best Practices for Dynamics Ax, but we’ll be covering a much wider range of topics over the coming months, such as Dynamics AOS configuration, X++ profiling, and leveraging new features of SQL Server 2008. Read the rest of this entry »


Development Features of Dynamics Ax (Axapta) 4.0

July 22, 2008
Digested from Microsoft specification:

Common Language Runtime (CLR) Interoperability
The CLR Interop feature allows X++ developers to add CLR assemblies to the AOT and write X++ code that interoperates with objects in these assemblies.
Read the rest of this entry »

Tips on optimizing primary index in Axapta

July 22, 2008
Primary index plays an important role in gaining optimum performance in Axapta. The Primary Index of a table is the main index that is used to uniquely identify records in it.
Read the rest of this entry »

Axapta build number

July 22, 2008

In Axapta, choose the option About Microsoft Business Solution-Axapta in the Help pull-down menu, you can see the Axapta build number information, e.g. Microsoft Business Solution-Axapta 3.0 Build # 1951.6710/514-320 SP4/OP023-196.

Read the rest of this entry »