EhLib.Com https://forum.ehlib.com/en/ |
|
Adding a record corresponding the added record in MemTableEh https://forum.ehlib.com/en/viewtopic.php?f=5&t=1287 |
Page 1 of 1 |
Author: | rezap405 [ 04 Sep 2024, 18:25 ] |
Post subject: | Adding a record corresponding the added record in MemTableEh |
I have TFDQuery-->TDataSetDriverEh-->TMemTableEh-->TDBGridEh components in my form. In a MemTableEh connected to the DBGridEh, whenever the user adds a row (that is, a record) in MemTableEh, I want the program to automatically add a new record equal to it (except for the value of some of its fields) immediately, and so on. For example, if it has 3 fields: FirstName, LastName and Age fields, the new record generated by the program will have the record values entered by the user, except for Age field, which I want to be empty, for example, the user should enter the following record with the following values: First Name: Alan Last Name: Cole Age: 36 The generated record corresponding to it should be as follows: First Name: Alan Last Name: Cole Age: null I used the AfterInsert event, one problem is that it got stuck in an infinite cycle because of recursive calls and adds infinite new records. What is the appropriate and optimal approach? Thanks |
Author: | EhLibSupport [ 04 Sep 2024, 21:42 ] |
Post subject: | Re: Adding a record corresponding the added record in MemTab |
Hello Do you want two records to appear in the DataSet after the user adds one record? |
Author: | rezap405 [ 05 Sep 2024, 02:51 ] |
Post subject: | Re: Adding a record corresponding the added record in MemTab |
No, I want the program to add only one record for each record the user enters. But this new record will be added automatically by the program codes in the BeforeInsert or AfterInsert or OnNewRecord event, or any other event that is suitable. It has the ability to be edited by the user before the user clicks on the save button. For example, in the above example, the end user edit the null age and input 24. So, I have two records, (Alan, Cole, 36) and (Alan, Cole, 24). |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |