Monday, June 4, 2018

WFA advanced incremental naming

In a previous post, I already explained how incremental naming works.  (

However, sometimes you need something a bit more advanced.
For example you need this incremental functionality

- myvol50xx
- myvol51yy
- myvol52zz
Using the classic incremental naming functionality, this no longer works as we have a changing suffix.

In this case you need to follow these steps :
  1. create a custom filter with regex (e.g. WHERE name REGEXP '${regex}'
    Search for the last item by using this regex '^myvol[0-9]{2}.*$
    => Hint : use skip this step if not found !
  2. Then use the _found property like this :

    This seems complex, but isn't.
    • If last volume found
      • Strip number from last volume
        • regex = ^myvol([0-9]{2})(.*)$
          This regex will parse your name and create 4 matches (using the brackets)
          Match 0 = the full string
          Match 1 = the string "myvol"
          Match 2 = the number
          Match 3 = the suffix
          In our case, we grab match 2 (the number)
      • And increase by 1
    • If not found
      • Return 1
  3. Finally use the number to reassemble the new name
    'myvol' + padNumber(NEW_NUMBER,2) + 'mysuffix'
The function "getRegexMatch", you can find on my github (

Along this function you can find interesting others.  I recently added a few new ones like :
  • trimEnd
  • getRegexMatch
  • getLastNumber
  • getLastNumberWithSuffix

No comments :

Post a Comment