Auto Numbering Column in Monday to Reset Every Month

I am looking for the “value” formula to use in Make that will achieve the below items when a new item is created.

  • Auto number starting at “1” but producing a 3 character number. “001”

  • Need the numbering to start back at “1” on the first day of each month.

Hello @Elijah_Eisenmann and welcome to the Community!

You may need to use a Increment module.

Could you please share how you’re using this module in your scenario?

2 Likes

I am still a little new to Make, but I think this is what you are asking for. If not let me know.

Ok, so your scenario will run whenever an Item is created in a Specific board.
Then, it will get that Item, then update that item’s PO Test value?
Seems you’ll need to keep track of and increment a counter variable.

There are likely a few ways to go about this, but you could try this:

  • Set up a Data Store with one value.
  • The key could be YYYY-MM and value could be the counter for that month.
  • At the beginning of the scenario, check the Data Store to see if there’s a value in YYYY-MM record. If not, start with number 1 for PO Test value. If so, add 1 to that number for the PO Test value.
  • After module #3, store the value used in PO Test in the Data Store. This way the scenario knows what number you used last.

When the scenario runs for the first time in a given month, that will cause it to create a new record in the Data Store, which will start a new counter at 1.

As for formatting your number to left-pad it with zeros up to 3 digits in length, again, multiple ways to do it. Here’s one way:

Basically take the number, divide it by 1000, format it using period as a decimal separator and nothing as the thousands separator, split it by the decimal, then take the last element of the resultant array which is everything after the decimal point.

image

Here’s the result using ‘4’ and ‘999’
image

This won’t work correctly in case your number exceeds 999 so a better approach might be to use a switch() function on the length of the number.
If it’s 1 digit then prepend it with 00.
If it’s 2 digits then pre-pend with 0.
Any other length, use the number itself.


image

3 Likes

This is fantastic, thank you so much. I will give some further feedback in a little bit once I have some time to build and test.

Apologies, but, as I stated earlier I am a bit new to Make.com. Can you please show me what the data structure for the data store is?

Looks like just two fields, if I read it correctly:

Key (string)

Value (number)

2 Likes

I understand that part. I don’t understand how to build a data store. Can someone please provide me what goes in each field?

Continuing your screenshot above,

Change “PO Auto Numbering” to “Key”

Change Type field “Date” to “String” (or text)

Click on Add item

Adding a new item –

Name field: “Value”

Type: “Number”

2 Likes

Ok thank you. I will try and continue building the rest. Thank you for your help.

Am I way off in left field here or does this look right? I am honestly lost when trying to write these values in. I scheduled a call with you for Monday morning to discuss further.

Sorry I should have mocked something up to give you a better idea, but I think you’re on the right track. I would replace Data Store Check the existence of a record with Data Store Get a Record. When you get something that doesn’t exist, it returns nothing instead of an error, and you can use that to indicate you should start at 1 in the Monday Update Column Values module.

You can remove the Increment Function because you would use the Monday Get an Item (#2) instead. If that module returns multiple bundles then you can go straight from that module to the next Monday module. If #2 returns an array or collection that contains all the Monday Items you want updated, then you’ll need to use an Iterator on that object collection.

There’s more, chat with you Monday!

2 Likes

Here’s what it would look like if Monday Get an Item only returns one item and Monday Update Column Values of a Specific Item only acts on a single column value.

How it works:
When a Board Item is created, using YYYY-MM, get the current PO Auto Numbering value, call it X.
Next, get the Item that was created in Monday then update the Item’s “PO Test” Column Value to X+1. (If X does not exist, then use 1). You can use the ifempty() function for this.
Finally, write the PO Test Number to the Data Store so the next time the scenario runs it will retrieve the updated value.

For figuring YYYY-DD for the Data Store key, you can do this using the formatDate() function like this:

For this to work the Sequential Processing needs to be enabled in Scenario settings.
That means when two Monday Board Items are created, the first one needs to finish this process before it will run on the next.

When creating the Data Store, the spec only needs one field, the PO Auto Numbering [Number type] field.
The key field is built-in so there’s nothing to specify there.

Here is what that Data Store would look like:


The result of this is two fields - key and PO Auto Numbering.

Hope that makes more sense.

2 Likes