How to add a Seq No Dynamically

Hi everybody

I have a table named EmployeeDocuments with two fields

  1. EmployeeID (it is actually a ForeignKey to another table Employees).

  2. SeqNo (It is an integer)

Both these fields collectively will make Primarykey for this table.

What I want to do is whenever a new Row is added into EmployeeDocuments table by the user. User should select only EmployeeID and I should add a SeqNo programitically by counting total no of rows already present in EmployeeDocuments table with the selected EmployeeID, Increment it with one and put it in SeqNo field.

How can I do it?

Thanks for the help in advance.

Hi Jazib,

U can do that by putting the code of calculating the total no of rows related to specific EmployeeDocuments and then increamenting it by 1 , in insert() method of table.

So, on saving the record, new SeqNo will generate.

Hope, it will help u…


Thanks manish_s it did help me.