RE: Number sequence based on enum value on the form
Hi Nikolaos,
Somehow I managed to reach close to the functioning. I have taken Fixed assets number sequence as per asset group for reference. I am able to generate number sequence now based on an enum value (field named category in my case). I have an issue now that, on the form if I select the same enum value again for the same record, the number sequence keep incrementing. for example if I select the first enum value the sequence should have generated and If I simply re select the same enum the sequence get incremented for the same record. here I am mentioning the modified method on the field category in my form and the init method which brings the sequence number. what can be done to fix it ?
void modified()
{
NumberSeq CategoryNumberSeq;
;
super();
if (CategoryNumberSeq);
CategoryNumberSeq.abort();
CategoryNumberSeq = MyMainTable.initCategoryNumberSeq();
if (CategoryNumberSeq )
{
MyMainTable.ItemId = CategoryNumberSeq.num();
}
MyMainTable.dataSource().refresh();
}
public server NumberSeq initCategoryNumberSeq(ItemCategory _Category)
{
MyCategoryTable = MyCategoryTable ::find( _Category? _Category : this.Category);
NumberSeq CategoryNumberSeq;
;
if (MyCategoryTable.AutoNumberSequenceTable)
{
CategoryNumberSeq = NumberSeq::newGetNumFromId(MyCategoryTable.AutoNumberSequenceTable, true);
}
return CategoryNumberSeq;
}