Generating a unique (but consecutive) ID that resets daily

My end user wants a unique ID that consists of “YY” + “DDD” + 12-digit consecutive number that resets to 1 each day - so it would be:

000000000001
000000000002
000000000003…

The date parts are cake, but the consecutive number is throwing me for a loop. I suggested using an UUID (which I trimmed of numbers/dashes and down to 12 digits), but they’d rather have the counter.

As it’s currently designed, documents are fed into the pipeline one at a time. I could explore batching them each day (which would allow me to use the sequence snap), but I’d prefer to keep the isolation.

Is there a way to count how many times the pipeline has run that day? or is there lower-hanging fruit that I’m missing?

Welcome to the Community @skline4552!

You can use the Public Monitoring API to get the pipeline execution statistics for the currently running pipeline and check the response count. This will include counts for every actual execution of the pipeline (ignores validations). Note that you could add query parameters to filter to only Completed jobs so you don’t miss numbers for jobs that didn’t complete successfully (see documentation).

Here is a small example pipeline that makes the call, which you can simply copy and paste the snaps into your pipeline since it works by using the currently executing pipeline metadata to build the call. Note that you will need to configure a REST Basic Account for the Rest Get snap with SnapLogic credentials that have Read+Execute access in your folder to be able to make the call or you will get an Unauthorized error.
Community 13552 - Pipeline executions today_2022_10_05.slp (4.7 KB)

Hope this helps!

2 Likes