# Unique sequential numbers for Web-based form

## Domino Resources - Part 7

### Looking for something else?

This code calulates a totally unique, sequential, 8 digit number for Web forms.

This number also allows for forms that are created at the same time. All forms will be unique accoring to the calulation below.

REQUEST NUMBER CALCULATION

This request number formula will produce a unique sequential number for each request.
EXAMPLE:

```1A44-316I

1  A  44 - 316  I
A  B  CC - CCC  D

A = The current month.
The month of October is X.
The month of November is Y.
The month of December is Z.
October , November , December are represented by letters because they are  2 digit months.

B = The current day.
Two digit days are represented by letters.
Example: day10=A , day11=B , day12=C  etc.

CC-CCC = Number of seconds past 12:00 AM of the current day.
There can be up to 86400 seconds in a day. So there needs to be 5 digits to account for.

D = Random Alpha Character.
To distinguish requests created at exactly the same second.

1 A 44-316 I

1=Month(January)
A=Day(10)
44-316=Time(12:18:36 or 43200+1080+36)
I=random alpha

Code: REM "REQUEST NUMBER CALCULATION";
REM ;
REM "This request number formula will produce a unique sequential number  for each request.";
REM ;
REM ;
REM "1A44-316I = January, 10 12:18:36 PM = 43200+1080+36";
REM ;
REM "1 A  44 - 316  I";
REM "A B  CC - CCC  D";
REM ;
REM ;
REM "A = The current month. ";
REM "The month of October is X.";
REM "The month of November is Y.";
REM "The month of December is Z.";
REM "October , November , December are represented by letters because they are  2 digit months.";
REM ;
REM ;
REM "B = The current day.";
REM "Two digit days are represented by letters.";
REM "Example: day10=A , day11=B , day12=C  etc.";
REM ;
REM ;
REM "CC-CCC = Number of seconds past 12:00 AM of the current day.";
REM "There can be up to 86400 seconds in a day. So there needs to be 5  digits to account for.";
REM ;
REM ;
REM "D = Random Alpha Character.";
REM "To distinguish requests created at exactly the same second.";

REM "Get the current year.";
year:=@Text(@Year(@Now));

REM "Get the current month.";
month:=@Right( ("0"+@Text(@Month(@Now))) ; 2);

REM "Get the current day.";
day:=@Right( ("0"+@Text(@Day(@Now))); 2);

REM "Get the current seconds past 12:00 AM this morning.";
start:=@TextToTime(month+"/"+day+"/"+year+" 00:00:00 AM");
fin:=@Now;
csc:=@Text((fin-start));

REM "Make the month a 1 digit character";
m := @If(
month = "10" ; "X" ;
month = "11" ; "Y" ;
month = "12" ; "Z" ;
@Right(month;1));

REM "Make the day a 1 digit character";
d:=@If(
day="10";"A";
day="11";"B";
day="12";"C";
day="13";"D";
day="14";"E";
day="15";"F";
day="16";"G";
day="17";"H";
day="18";"I";
day="19";"J";
day="20";"K";
day="21";"L";
day="22";"M";
day="23";"N";
day="24";"O";
day="25";"P";
day="26";"Q";
day="27";"R";
day="28";"S";
day="29";"T";
day="31";"U";
day);

REM "Add leading zeros for the current seconds past 12:00 AM if necessary.";  c:=@Right("0000"+csc;5);
c1:=@Left(c;2);
c2:=@RightBack(c;2);

REM "Calculate a random alpha character.";
rand:=@Right(@Unique;1);
r:=@If( rand = "0" ; "A";
rand = "1" ; "B";
rand = "2" ; "C";
rand = "3" ; "D";
rand = "4" ; "E";
rand = "5" ; "F";
rand = "6" ; "G";
rand = "7" ; "H";
rand = "8" ; "I";
rand = "9" ; "J";rand);

REM "Display request number...";
m+d+c1+"-"+c2+r
```
This was last published in January 2002

#### Start the conversation

Send me notifications when other members comment.

## SearchWindowsServer

• ### Pester PowerShell unit testing ensures quality code

PowerShell jockeys can turn to the Pester unit testing framework to ensure the code they write is up to snuff.

• ### Microsoft software-defined networking gets baked into Windows Server

The Microsoft SDN technology that comes in the Windows Server 2016's Datacenter edition features a range of basic to nuanced ...

• ### Microsoft rings in new year with light January Patch Tuesday

Microsoft starts 2017 with just three bulletins, but administrators who manage Windows Server 2008 and 2008 R2 should pay close ...

## Search400

• ### iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• ### V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• ### Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

## SearchEnterpriseLinux

• ### SUSE Linux jumps on the open private cloud deployment train

SUSE Linux Enterprise planning private cloud deployment with OpenStack weight behind it. NVIDIA works on Linux drivers for ...

• ### Want one of the many Linux jobs out there? Time to go back to class

Does extended education from the Linux Foundation and others help graduates meet the demands of today’s Linux jobs? Some say yes.

• ### Ubuntu ARM server AMI for Amazon EC2 offers fast access in the cloud

Canonical’s Ubuntu ARM server AMI for Amazon EC2 provide open source shops with a fast ARM server for the cloud.

## SearchDataCenter

• ### HPE-SimpliVity deal raises support, price and development questions

With HPE's buy of No. 2 SimpliVity -- the first big deal in the HCI space -- IT pros see a more robust offering, but also higher ...

• ### Converged infrastructure drop-off doesn't mean data center death

Traditional converged infrastructure has been supplanted by hyper-converged infrastructure and cloud computing, but it remains a ...

• ### New options to evolve your data backup and recovery plan

The server backup market first evolved to protect VMs, but now it's undergoing another transformation. Find out how it's evolved ...

## SearchExchange

• ### Five reasons for an Office 365 hybrid deployment

Not all organizations can go all-in on cloud. There are five reasons why a hybrid Office 365 arrangement makes sense for those ...

Admins must keep a close eye on Exchange Server to ensure it runs at peak performance. If cost is an issue, there are a number of...

• ### Avoid disaster with these Exchange 2013 backup options

Exchange Server administrators have a number of ways to keep disaster from sinking a key part of the corporate infrastructure.

## SearchContentManagement

• ### Why SharePoint Framework could benefit business, not just developers

SharePoint Framework heralds a new, mobile-friendly, low-code era for Microsoft, which may give some organizations without .NET ...

• ### Using Microsoft MyAnalytics to improve workers' time management

Microsoft MyAnalytics has been hailed as the next great thing for analyzing worker productivity. But how can employees be assured...

• ### Is the Drupal content management system right for your business?

The open source Drupal content management system offers users responsive design and WYSIWYG content and web development tools, as...

Close