Hi,
Without using number sequence functionality, how can I generate a sequence through coding ?
For example, Lets suppose I have 5 fields in my table, A,B,C,D,E. After creating the form of the table, when I shall click NEW button on the form, A must be initialised with +1, of previous stored value. For example, if the previous value stored is 8, then on clicking NEW, it must be 8+1 = 9. How can I achieve this ?
Hi ,
You have to use the following Code in Datasource Create Override method, The Field A should be as Integer dataType.
int Counter;
MyTable _MyTable; // which contains your A, B,C,D,E fields
;
super(_append);
select maxOf(A) from _MyTable;
DatasourceName.A = _MyTable.A + 1;
Note: If you have included Number sequence concept in this form you have to remove it,
Hope it will work
Hi SADULLAH,
Thanks for your advice, but I am not getting the desired result. Please suggest me the other possible ways.
Thanks
Dear Pioneers,
Share your opinions please !!!
If you don’t need the value immediately when a record is created, you can assign it directly in insert() method.
Nevertheless if duplicate values are not acceptable, think about what happens if two users try to create a new record in the same time. Number sequences would deal with that for you - but it’s your responsibility now.