Customer creating new record in table. Once he deleted the last record of table and he inserting a new record at that time he want to apply last deleted record number to newly created record.
I wrote the code in table level deleted method.
public void delete() { NumberSequenceTable numSeqTable; MyId myId; ; myId= MyTable.MyId; numSeqTable = NumberSequenceTable::find( SalesParameters::numRefMyId().NumberSequence); super(); if (numSeqTable.Continuous) { NumberSeq::release(SalesParameters::numRefMyId().NumberSequence, myId); } else { if (NumberSeq::numInsertFormat(numSeqTable.NextRec - 1, numSeqTable.Format) == myId) { ttsbegin; numSeqTable = NumberSequenceTable::find( numSeqTable.NumberSequence, true); numSeqTable.NextRec--; numSeqTable.doUpdate(); ttscommit; } } }
Ref :
https://stackoverflow.com/questions/35247361/how-to-recover-a-number-sequence-just-used
Keep daxing!!
No comments:
Post a Comment