In this article we will see about how to create auto number sequence when we create row in table. Here is the example to create auto number sequence while create row in table.
public void initValue()
{
str _newCode;
int max1;
TaskOne taskOne;
super();
select firstOnly SerialNo from taskOne order by RecId desc;
if(!taskOne.SerialNo)
{
ttsBegin;
_newCode=strRFix(int2str(1),4, "0");
this.SerialNo = _newCode;
ttsCommit;
}
else
{
ttsBegin;
max1=str2int(subStr(taskOne.SerialNo,4,4))+1;
this.SerialNo =strRFix(int2str(max1),4, "0");
ttsCommit;
}
}
public void initValue()
{
str _newCode;
int max1;
TaskOne taskOne;
super();
select firstOnly SerialNo from taskOne order by RecId desc;
if(!taskOne.SerialNo)
{
ttsBegin;
_newCode=strRFix(int2str(1),4, "0");
this.SerialNo = _newCode;
ttsCommit;
}
else
{
ttsBegin;
max1=str2int(subStr(taskOne.SerialNo,4,4))+1;
this.SerialNo =strRFix(int2str(max1),4, "0");
ttsCommit;
}
}
No comments:
Post a Comment