How to set a function value for the AutoEnter of a field

Hello,

How can I set a function value to the AutoEnter of a field.

I have a character field with a lenght of 12. I need that everytime a new record is added it be fill as follows:

YYBBOOOOOOOO

Where:
YY = Last 2 characters of the year
BB = The Branch number I keep it in a Global Variable
OOOOOOOO = Is a autoincrement value formatted with 0 in the left.

So if I create a new record in 2010 from the branch 2 it should return 100200000001, next record 100200000002 and so on. In branch 1 it would be 100100000001.

I´m thinking about having a table that keeps track of the incrementing number but how do I tell Servoy to call the function that creates the string?

Thanks in advance

I guess you could use a table event for this. (see Events tab in your table editor)

Hope this helps.