Creating a unique number / ID in Omnis Studio

Doug Easterbrook doug at
Fri Nov 18 14:22:47 UTC 2022

hi Nick.

I’m going to assume that there is a temporary number (never saves in a database) and local to a machine.    In other words, If you add a line to a list, you want a unique number in that list.    if you restart omnis, you can start again at 1, and there is no need to refer to that same number on another machine.

I”m assuming tyhat, because #CT is unique to a machine and starts at zero if you restart the machine.

if so, I’d suggest making a class variable (if the number can be unique to a window) or a task var if the number is to be unique to all lists in all windows.


task var    ID  integer 64 bit initial Value 0

and make a small method in your startup task called ‘$nextID’ that you can refer to in your $add

do list.$add($ctask.$nextID,rest of variables)

and $nextID is

calculate ID as ID 1
quit method  ID

just replace any use of #CT with the  $ctask.$nextID function call

that way you don’t need to change the variable type within your lists if you went with timestamps or UUID’s or what have you.  Your existing code should just work.

it seems to me that all you are doing is serializing your lines in your list locally.

Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at
Phone (403) 650-1978

> On Nov 18, 2022, at 5:38 AM, Nick Renders <omnis1 at> wrote:
> Hi List,
> I was wondering if anyone had any good tips when it comes to creating unique numbers or IDs in Omnis?
> For instance, to identify a specific row in a List variable whose number of lines is constantly changing (with $addbefore, $addafter, and $remove).
> I have been using #CT (number of ticks) but technology has caught up, and now there are situations with duplicate values because the calculations are done in the same 1/60th of a second.
> Any suggestions?
> Thanks,
> Nick Renders
> _____________________________________________________________
> Manage your list subscriptions at
> Start a new message -> mailto:omnisdev-en at 

More information about the omnisdev-en mailing list