My actual custom Table contained a field that was based on a Number Sequence. Thus in my process, when I programmatically inserted a new record into my custom Table, per customer, I needed to generate the next number sequence for each record. A little digging led me here which revealed some of the code that I was looking for.
On the clicked() method of my “Process” button I essentially did the following:
void clicked()It should be noted, that in my initial run of the code, I did not include the ttsbegin and ttscommit lines. This however threw the following error:
{
tbl_Complaint complaintReport;
NumberSequenceReference nsr;
NumberSeq ns;
;
while select temp
{
ttsbegin;
complaintReport.CustNumber = tmt.CustNumber;
complaintReport.Name = tmt.Name;
nsr = tbl_Complaint::numRefComplaintId();
ns = NumberSeq::newGetNum(nsr, false, true);
complaintReport.ComplaintReportId = ns.num();
complaintReport.insert();
ttscommit;
}
super();
}
“System does not support setup 'continuous' of number sequence”Once again, after doing a little digging, it was here that I learned of my options to resolve this error, which for my needs was solved by implementing transaction scope.
:) I to faced the error : “System does not support setup 'continuous' of number sequence” and wrote the following code to solve the error. thank you for your help
ReplyDeletettsbegin;
select VoucherSeqId from projJournalName
where ProjParameters.PSALogSheetEntryJournalNameId == projJournalName.JournalNameId;
numberseq = NumberSeq::newGetVoucherFromCode(projJournalName.VoucherSeqId).voucher();// ProjJournalName Table's VocheSeqId
//info(strfmt("%1",numberseq));
ProjJournalTrans.Voucher = numberseq;//strfmt("%1",numberseq);//numberseq.voucher();
ProjJournalTrans.insert();
ttscommit;