Hello everyone, Please help me I want to set Queue number from 1 to 99 after 99 and then auto reset .
Custom daily order number covered many times on forum, just change reset to 1 from end of day to in rule to reset to 1 if 99 rsther than increase.
I modified something I put together in the past:
see this post for usage:
function get()
{
var q = "SELECT Value From dbo.ProgramSettingValues WHERE Name = 'SequenceNumber'";
var r = sql.Query(q).First;
var sequenceNumber = r;
if (r == null)
{
var q = "INSERT INTO dbo.ProgramSettingValues (Value, Name) VALUES ('1', 'SequenceNumber')";
sql.Exec(q);
sequenceNumber = 1;
}
else if (sequenceNumber == 99)
{
sequenceNumber = 1;
}
else
{
sequenceNumber++;
}
q = "UPDATE dbo.ProgramSettingValues SET Value = '"+sequenceNumber+"' WHERE Name = 'SequenceNumber'";
sql.Exec(q);
//return Helper.Format(sequenceNumber,'00');
return sequenceNumber;
}
uncomment line 26 and comment line 27 if you need leading zeros (e.g. 01, 02, 03 etc.)