Identifier Generator & Insertion

The latest beta feature is out. In simple terms, it is a spreadsheet connected to your snippet. Let's see how to solve your use case with that

Table

Visit spaces link, create a space and then create a table inside it with name (IdentifierGeneration):

Snippet

The snippet is below. For it to work, first you need to set the value of space=CHANGE_ME to the space ID, which you can get from the URL https://dashboard.blaze.today/space/SPACE_ID/table/TABLE_ID/

{note}
{dbselect: SELECT Prefix, Count FROM IdentifierGeneration ORDER BY Count DESC; space=CHANGE_ME; menu=yes}{if: prefix == "CREATE NEW"}{use_count=1}Type new prefix to add: {formtext: name=use_prefix}{else}{use_count=count+1}{use_prefix=prefix}{endif}
Visual padding: {formtext: name=padding_count}{padded_use_count=base(use_count, 10, padding_count)}
{endnote: trim=yes}
{=use_prefix}{=padded_use_count}
{if: prefix == "CREATE NEW"; trim=yes}{dbinsert: INSERT INTO IdentifierGeneration SET Prefix=@use_prefix, Count=@use_count; space=CHANGE_ME; autoaddfields=no}{else}{dbupdate: UPDATE IdentifierGeneration SET Count=@use_count WHERE Prefix == @use_prefix; space=CHANGE_ME; autoaddfields=no}{endif}

Then you can copy and paste this snippet into your Text Blaze dashboard snippet editor. In the preview, you will see: "Invalid Data Blaze query - Cannot use a DB command with this query. You can reconfigure the folder to allow access - Configure folder". Press "Configure folder" to allow the snippet to access your space.

Once this is all done, the snippet should work pretty much exactly as you have described :slight_smile:

Please let me know if you face any issues. This is a new beta feature and we can't wait to see the advanced use cases our users build on top of it!

1 Like