Working with numbersequences – On forms

February 18, 2010 No comment

When you want to implement NumberSequences in a Ax form (new numbersequence when you create a record etc.) you can just implement the ‘numberSeqFormHandler’.

Step-by-step: (more…)

Working with numbersequences – Keep In Mind

February 17, 2010 No comment

When you are using a Number Sequence, keep in mind that a Continuous Number Sequence is slower than a non-continuous. The reason is that the system creates a record in the table NumberSequenceList (with the status Active) and cleans it up later during TTSCOMMIT.

Performance tip: You can improve the performance of a process that creates many numbers of one Number Sequence by using number pre-allocation. This loads a set of numbers into the memory and provides faster access. You can do this by using the NumberSeqGlobal, witch means that once it is instantiated, it is available until the session is closed. This function is only available for non-continuous Number Sequences. The numbers can only be retrieved from the cache by calling the getNumInternal() method in the NumberSeq_Fast class.

Working with numbersequences – New Module

February 16, 2010 No comment

In a previous post I explained how to create a new Number Sequence in a existing module (Working with numbersequences – new NumberSequence). In this post I will explain how you can create a new Number Sequence-module.
I will create a new module called TEST (lack of inspiration).

Step-By-Step: (more…)

Working with numbersequences – new NumberSequence

May 5, 2009 1 comment

When you want to create a new NumberSequence in AX you have to do the following steps:
1. Create a new Extended Data Type (EDT). Often this EDT extends from num. (this step is not mandatory, but it is a best practice)

2. Discide in witch module this new Number Sequence Reference (classes NumberSeqReference_…) should be included and find the corresponding NumberSeqReference class. (ex. module sales –> NumberSeqReference_SalesOrder)

3. The loadModule() method shows a number of blocks of code, which creates records in the table NumberSequenceReference.

4.Copy a block and change the following fields:
* DataTypeID is the type Id of the new data type.
* referenceLabel is the description shown in the left column of the Number sequence tab on the parameters form.
* referenceHelp is the longer description of the reference shown in the top part of the Number sequence tab of the parameters form.
* sortfield defines the sequence that the references are displayed on the Number sequence tab of the parameters form.
* The wizard fields are default values when using the wizard to create a numbersequenceexample:

1
2
3
4
5
6
7
8
9
numRef.DataTypeId = typeId2ExtendedTypeId(typeid(NewType));
numRef.ReferenceLabel = literalstr("@...");
numRef.ReferenceHelp = literalstr("@...");
numRef.WizardManual = NoYes::No;
numRef.WizardAllowChangeDown = NoYes::No;
numRef.WizardAllowChangeUp = NoYes::No;
numRef.SortField = #;
 
this.create(numRef);

5. Create a static method on the parameter table that will be used to retrieve the reference. These methods usually start with “numref”.
example:

1
2
3
4
static client server NumberSequenceReference  numRefNewType()
{
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(NewType)));
}