Generation of sequence number in webmethods


This is regarding the generation of unique sequence number in webmethods.Currently we are using webmethods version 9.12 and need to put files into SFTP server by creating the folder name for the file with a unique a 4 digit sequence number per file and per day.

Eg.If file 1 is coming today ,we need to name the file as DDMMYYYYNNNN where NNNN is the unique 4 digit sequence number for the file.
So the file name should be something like 150220170001 .

Also if im receiving ten files today then the last file would be 150220170010.

But when i recieve files tomorrow the file sequence number should again start from 0001 with that days date.(Eg 160220170001)

Can someone please let me know if there any inbuilt service in webmethods which we can use for generating this sequence number automatically or do we need to write java service for the same?


Hi Swaathi,

I currently think of the following scenario for your case:

create a global variable for the counter
each time your create filename increment the counter
have a scheduled service in place to reset the counter to 1 at midnight.

Other techniques might be to use the pub.cache:* or* services.


Hi Holger,
Global Variable works only with one IS instance, isn’t it? What if the IS is clustered in production?

Hi Swaathi,
NNNN - only a 4 digit number? This puts a restriction that, the number can go only upto 9999 per day.
You can use DB sequence object and get a next sequence number generated.
Or you need to have a file in a mounted drive where instances of IS can read, and you can maintain the number in there.

There is no direct way of getting sequence number in a clustered wM environment without a common distributed cache, or persistence of that in either db/file system.