Although there are some good post about this online I post another short instruction bout "How to create a NumberSequence" here:
- create an EDT - in this Example we call it MyNewNumberSeqId
- Edit the loadModule Method of the NumberSeqReference_... Class of your Module
add this code
numRef.DataTypeId = typeId2ExtendedTypeId(typeid(MyNewNumberSeqId));
numRef.configurationKeyId = configurationkeynum(ABCBasic);
numRef.ReferenceHelp = literalstr("@ABC123");
numRef.WizardContinuous = true;
numRef.WizardManual = NoYes::No;
numRef.WizardAllowChangeDown = NoYes::No;
numRef.WizardAllowChangeUp = NoYes::No;
numRef.SortField = 1;
this.create(numRef);
- create a new method in the ParametersTable of the Module - For Example SalesParameters
public client server static NumberSequenceReference numRefMyNewNumberSeqId()
{
;
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(MyNewNumberSeqId)));
}
- done
to use this NumberSequence create a numberSeq object and call its num method. I often call this method in the insert of the Datasource in which the NumberSequence is used:
public void insert()
{
NumberSeq numberSeq;
;
if (this.MyNewNumberSeqId== "")
{
numberSeq = NumberSeq::newGetNum(SalesParameters::numRefMyNewNumberSeqId());
this.MyNewNumberSeqId= numberSeq.num();
}
super();
}
No comments:
Post a Comment