This topic is locked

Auto Increment Number

2/24/2014 12:15:23 PM
ASPRunnerPro General questions
author

Hello all,
I am using MS Sql with ASPRunnerPro 8.1 build 20499.
I have a database (Main) with a field in it called SafeCaseID which is a text field. Using the properties of the field, I would like to auto fill the field with the year-AutoIncrement number such as:
SafeCaseID Field
Record1 2014-0001

Record 2 2014-0002
So for the year section of the field it sees the current year then after the dash it increments the number by 1. When the new year begins it resets the year to new year (2015) and resets the increment to 0000.
Anyone have an idea on how to achieve this using the ASP Code Editor for the "Default value" of the Edit as properties?
Thanks in advanced.

Joe

G
gonzalosb 2/25/2014

Fast thinking can be make the field as text and add custom " 'date(year)' - 0000 " and then create a function before display to rename if existing already with a sum of the "0000 + 1".

I’m not sure how can be done and I don’t promise anything but let me see if I can help with something.
other way can be " 'date(year)' & 'value("KEY ID FIELD")'" but this will never get back to "0000" when year change.

1312 2/26/2014



Fast thinking can be make the field as text and add custom " 'date(year)' - 0000 " and then create a function before display to rename if existing already with a sum of the "0000 + 1".

I'm not sure how can be done and I don't promise anything but let me see if I can help with something.
other way can be " 'date(year)' & 'value("KEY ID FIELD")'" but this will never get back to "0000" when year change.


I knew about pulling the year from the system and was going to use that portion but it was the 0000 increment and resetting each new year that I was not sure on how to do.
Thanks
Joe