I have created two tables with integer fields in both the fields of different length, I also have a separate field in the 2nd table to save the error message received in the last transaction.
But what I want if I transferring a total of 100 records means and if the error occurs at the 10 record the transactions stop, I want the transaction to be continuous even if the runtime error occurs.
Besides in your code you do a fromtable.FINDFIRST; - THIS IS WRONG. NEVER use a FINDFIRST if you need more than one record. then use either FINDSET or FIND(’-’) (Preferable FINDSET if you are modifying records).
ALSO never use TABLE.INSERT / TABLE.MODIFY or TABLE.DELETE without adding (TRUE) meaining in your example: totable.INSERT(TRUE)
totable.DELETEALL;
fromtable.RESET;
fromtable.FINDFIRST;
REPEAT //totable.INIT; //totable.TRANSFERFIELDS(fromtable); //totable.INSERT;
//MESSAGE(FORMAT(‘code runs here’));
COMMIT;
IF NOT errorcapture.RUN(fromtable) THEN
BEGIN
totable.INIT;
totable.Field1 := ‘Prim_Key’;
totable.INSERT;
totable.ErrorText := COPYSTR(GETLASTERRORTEXT, 1, MAXSTRLEN(totable.ErrorText));
totable.INSERT;
END ELSE BEGIN