Generate Unique Numeric Key for table
Ninox Profile

Lets assume you want to create your one unique numeric key for a table object and you want to ensure it is of a fixed number of digits..

Here is a quick hack..   (put this code in a global function) 

Table Name : UniqueKey (your table might be Invoice, Customer, Project, etc... )
Field 'Key Size' must be a numeric value between 1 and 12 (inclusive).. of course you can hard code it for your needs.. 

The code.. 


If you have other approaches.. would like to see them.. 


Ninox Profile

OK Folks.. here is the code as a global function... WHY a global function you may ask????   Because when you execute something like.. 

let uk := create UniqueKey; 

Ninox will NOT execute the "on create trigger" .. therefor .. I put it into a global function so I can call it after I create a row via a script. 


PS.. I have an email into support.. For some reason.. I am getting a strange error that if this is the FIRST (or only) global function .. AND I was passing in number from a form field.... it would pass the number in as empty string.. Not sure why..