The below code can be used to create a new number sequence record and format can also be specified without opening the form.
NumberSequenceTable numberSeqTable;
NumberSequenceScope numberSeqScope;
container segments;
str annotatedFormat, format;
;
NumberSequenceTable numberSeqTable;
NumberSequenceScope numberSeqScope;
container segments;
str annotatedFormat, format;
;
select numberSeqScope
where numberSeqScope.DataArea == 'QYS';
segments += [[0, 'QYS']];
segments += [[-1,'-']];
segments += [[-2,'######']];
annotatedFormat = NumberSeq::createAnnotatedFormatFromSegments(segments);
format = NumberSeq::createAnnotatedFormatFromSegments(segments, false);
numberSeqTable.clear();
numberSeqTable.NumberSequence = '111';
numberSeqTable.Txt = 'Test';
numberSeqTable.AnnotatedFormat = annotatedFormat;
numberSeqTable.NumberSequenceScope = numberSeqScope.RecId;
numberSeqTable.Format = format;
numberSeqTable.Highest = 999999;
numberSeqTable.Lowest = 1;
numberSeqTable.NextRec = 1;
numberSeqTable.insert();
Helped alot! Thank you.
ReplyDeleteWelcome :)
ReplyDelete