Announcements
Hi all,
Hope you're doing fine.
I had to face a business need that requires to use several sequence number on the same field based on some selection from a list or an Enum, I didn't know how to do it at first, but I managed to do it.. so I'm sharing it with you, I hope it helps
1- first you need to check if the targeted field has number sequence assigned or not, if yes… You need to either cancel the setup for this field or just make the number sequence manual
2- you need to create N number of EDT equals N number of sequence numbers you'll use
3- find the number sequence module you want your number sequences to belong to it and create N number of parameters data type like below:
datatype.parmDatatypeId(extendedTypeNum("EDTname"));
datatype.parmReferenceHelp(literalStr("EDT Name")); //this a string, so you write it with quotes like this "Sales Id", it's the reference help so describe it like you want
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmSortField(52); // that's not a constant value, just check for the last parameter number and add 1
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
you can change any value according to your business case
4- create a job that loads the number sequence module like below:
//assuming the number sequence module is NumberSeqModuleCustomer
NumberSeqModuleCustomer numberSeqMod;
numberSeqMod = new NumberSeqModuleCustomer();
numberSeqMod.load();
//run the job
5- create N number of methods in the table which holds the targeted field like below:
static client server NumberSequenceReference "method name"()
{
return NumberSeqReference::findReference(extendedTypeNum("EDT name"));
}
6- after you check for the selection of your list or Enum, assign the field like below:
"TableName"."FieldName"= NumberSeq::newGetNum("TableName"::"MethodNameforspecificEDT"(),true).num();
Hi Kareem,
thanks for the sharing. I am trying to apply the same logic but I having issues with some of the steps
I am on the step numer 6. "after you check for the selection of your list or Enum, assign the field like below:"
"TableName"."FieldName"= NumberSeq::newGetNum("TableName"::"MethodNameforspecificEDT"(),true).num();
where is this assign?.
I am trying to use two numSeq for ProdTable.ProdId. so when a new production is created it should ask me for the numSeq that I want to use, like dropdown list?
I haven't work with number sequence by x++ before so some steps are new for me..
thanks before hand for the help
Thank you, Martin
I didn't know that there's the ability to start a bog here, I'll go for it
This seems to belong to your previous thread, Multiple number sequence on the same field. I'll at least link those threads...
Maybe you'd interested in starting a blog. Note that discussions forums are intended for discussion, which isn't the case of this thread.
And when pasting code to the forum, please use Insert > Insert Code (in the rich-formatting view).
Thank you for the share
André Arnaud de Cal...
293,302
Super User 2025 Season 1
Martin Dráb
232,108
Most Valuable Professional
nmaenpaa
101,156
Moderator