Change type (Add/Modify/Duplicate): Add
The following table shows the property setup of the table.
Property
|
Value
|
Description
|
Name
|
MyModuleParameters
|
Module name (prefix) + "Parameters".
|
Label
|
@........
|
Mandatory.
|
TableContents
|
Default data
|
Set according to the contents of the table. Outcome should be default data.
|
MaxAccessMode
|
Edit
|
No add or delete.
|
TableGroup
|
Parameter
|
Mandatory: Parameter.
|
Primary Index
|
KeyIdx
|
Unique index
|
Cluster Index
|
KeyIdx
|
Unique index
|
CacheLookup
|
Found
|
Found cache activated.
|
Fields:
Field name
|
Type
|
EDT/Enum
|
Mandatory
|
Label
|
Key
|
Integer
|
ParametersKey
|
No
|
--
|
Indexes:
Index name
|
Field(s)
|
Properties
|
KeyIdx
|
Key
|
AllowDuplicates: NO
|
This table must follow the standard Microsoft Dynamics AX design for parameter tables. The table must contain find method. The delete, validateDelete and update methods must be overridden. These methods must be on the same lines as one of the other parameter tables, such as LedgerParameters.
Methods:
Implement the MyModuleParameters:: numberSeqModule and MyModuleParameters:: NumberSeqReference methods. Ensure that your NumberSeqModule methods reference the new element that you created in the NumberSeqModule base enum.
For example:
1. MyModuleParameters:: numberSeqModule method
static NumberSeqModule numberSeqModule()
{
;
return NumberSeqReference_MyModule:: numberSeqModule();
}
2. MyModuleParameters:: numberSeqReference method
server static NumberSeqReference numberSeqReference()
{
;
return NumberSeqReference::construct( MyModuleParameters:: numberSeqModule());
}
3. MyModuleParameters::numRefMyMo dule_EDT method
server static NumberSequenceReference numRefMyModule_EDT()
{
;
return NumberSeqReference:: findReference( typeId2ExtendedTypeId(typeid( MyModule_EDT)));
}
4. MyModuleParameters::find method
static MyModuleParameters find()
{
MyModuleParameters parameter;
;
select firstonly parameter
index Key
where parameter.Key == 0;
if (!parameter && !parameter.isTmp())
{
Company::createParameter( parameter);
NumberSeqReference::construct( MyModuleParameters:: numberSeqModule()).load();
}
return parameter;
}
Create a new class called NumberSeqReference_MyModule. Let this class extend theNumberSeqReference class. The class must contain loadModule method and numberSeqModule method. These methods can be copied from one of the other parameter tables, such as LedgerParameters
For example:
1. NumberSeqReference_MyModule:: loadModule method
protected void loadModule()
{
NumberSequenceReference numRef;
;
numRef.dataTypeId = typeid2extendedtypeid(typeid( MyModule_EDT));
numRef.referenceHelp = literalStr("Unique key for My module EDT. The key is used when creating new modules."); // Use Labels here
numRef.wizardContinuous = true;
numRef.wizardManual = NoYes::No;
numRef.wizardAllowChangeDown = NoYes::No;
numRef.wizardAllowChangeUp = NoYes::No;
numRef.sortField = 1;
this.create(numRef);
}
2. NumberSeqReference_MyModule:: numberSeqModule method
public static NumberSeqModule numberSeqModule()
{
;
return NumberSeqModule::MyModule;
}
Modify class called NumberSeqReference. Add a new line in theNumberSeqReference::construct method.
For example:
// My module addition begin
case (NumberSeqReference_MyModule:: numberSeqModule()): return new NumberSeqReference_MyModule(_ module);
//My module addition end
Add a new line in the NumberSeqReference::moduleList method.
For example:
// My module Begin
moduleList += NumberSeqReference_MyModule:: numberSeqModule();
// My module End
Create a form to display the new parameter table. It is important that the functionality of numbersequence references is on the same lines as the LedgerParameters forms. The form must contain numberSeqPostInit method, numberSeqPreInit method and override init method.
For example:
1. Class Declaration
public class FormRun extends ObjectRun
{
NumberSeqReference numberSeqReference;
boolean runExecuteDirect;
TmpIdRef tmpIdRef;
fieldId tmpFieldId;
}
2. MyModuleParameters:: numberSeqPostinit method
void numberSeqPostInit()
{
ctrlAllowSameAs.visible( numberSeqReference. sameAsActive());
ctrlLabelSameAs.visible( numberSeqReference. sameAsActive());
}
3. MyModuleParameters:: numberSeqPreinit method
void numberSeqPreInit()
{
runExecuteDirect = false;
numberSeqReference = MyModuleParameters:: numberSeqReference();
numberSeqReference.load();
tmpIdRef.setTmpData( NumberSequenceReference:: configurationKeyTableMulti(
[MyModuleParameters:: numberSeqModule()]));
}
4. MyModuleParameters::init method
void init()
{
;
this.numberSeqPreInit();
super();
MyModuleParameters::find();
this.numberSeqPostInit();
}
In the method node of the NumberSequenceReference datasource it is needed to add the executeQuery method.
For example:
1. NumberSequenceReference: executeQuery method
void executeQuery()
{
if (runExecuteDirect)
{
super();
}
else
{
runExecuteDirect = true;
this.queryRun( NumberSeqReference:: buildQueryRunMulti( numberSequenceReference, tmpIdRef,[MyModuleParameters:: numberSeqModule()]));
numbersequenceReference_ds. research();
}
}
No comments:
Post a Comment