Creating an automatically generated locked field in Delphi

by user9832511   Last Updated May 23, 2018 11:06 AM

I need to create an automatically generated locked field (that can't be a free entry). This field looks like this (this is an example): 2-0103-1/2017. In this example, number 2 represents the number of department in which the document is created. Number 0103 is a date in the form month and day.

Number 1 is the ordinal number of a document for current day. This field needs to be auto incremented as long as there are documents for the same (current) day. After the day ends, it should be restarted to 1.

Field 2017 represents the current year.

My question is, how to implement this in Delphi? What is the easiest way? Is it by using database triggers (I am using MSSQL) or application logic (through Delphi coding). Could someone please explain?

Please give detailed explanation on how to implement this (either way).

Could you give concrete code sample snippets (in Delphi or in database triggers)?

Related Questions

Cannot open .jpg on Windows Server

Updated June 19, 2018 15:06 PM