Generate numbers: pull out birth year, generate running number, concatenate

Assume you want to automatically generate membership numbers. Rules as such:

The first four digits is the year of birth in YYYY format.

The last four digits is a running number by year.

For example, Alan’s year of birth is 1980, Ben’s year of birth is 1979, Carl’s year of birth is 1980. The three membership numbers generated will be 19800001, 19790001, 19800002.

How do you pull out the birth year from a birth date? How do you generate a running number AND append it to the birth year? How can you ensure that the combined number does not exceed 8 digits in length?

Hi YS Yeo,

If you have the birth date you can always use the function


 It will return an Integer.

I hope this helps.


You can fetch the year/month/day by doing:


For running number you can go a few routes you could fetch the previous entry for the same year and add 1 to that value. Though this can possible create duplicates if 2 users with the same year register at the same time.

Another solution is to use a seperate entity where you store the running number for each year.

Make sure you lock this record when you try to update it (you can use an action called GetEntityForUpdate, which is found in at the Entity  in the data tab).

Why would you limit your number on 8? What if you have so many users that you require a larger number than 8?