My page has a level 1 grid whose primary record is a "top of stack" view. When the user modifies a "top of stack" row, upon the Save I do a CopyTo(&Rec), where &Rec is the underlying table, then I increment the effdt and effseq appropriately, then do a &Rec.Insert.
I am doing this for several grids on the page at the same level, and all grids work fine except this one grid. In all cases, the level 1 scrolls have one extra key than the parent. In this case, the trace shows the &Rec.Insert succeeding, then it attempts the "Select for Update" into the original view giving the original effdt. This doesn't happen for any other grid. All other grids stop after the insert.
TRACE FILE:
If GetRow().IsChanged Then
&Rec = GetRecord();
If &Rec.EFFDT.Value = %Date And
GetRow().IsNew = False Then
&Rec.EFFSEQ.Value = &Rec.EFFSEQ.Value + 1;
Else
&Rec.EFFDT.Value = %Date;
&Rec.EFFSEQ.Value = 0;
End-If;
…
&REC2 = CreateRecord(Record.ZG_ENT_KC);
&REC2.SetDefault();
&Rec.COPYFIELDSTO(&REC2);
&REC2.Insert();
Stmt=INSERT INTO PS_ZG_ENT_KC (ZG_ENTITY_ID,EMPLID,EFFDT,EFFSEQ,EFF_STATUS,PHONE, EMAIL_ADDR,LASTUPDOPRID,LASTUPDDTTM) VALUES (:1,:2,TO_DATE(:3,'YYYY-MM-DD'),:4,:5,:6,:7,:8,TO_TIMESTAMP(:9,'YYYY-MM-DD-HH24.MI.SS.FF'))
value=V0000001
value=7269 555
value
10-07-19
value=0
value=A
value=444/444-4444
value=
value=743156
value
10-07-19-19.36.34.000000
End-If;
Stmt=SELECT ZG_ENTITY_ID, EMPLID, EFFDT, TO_CHAR(EFFDT,'YYYY-MM-DD'), EFFSEQ, EFF_STATUS, PHONE, EMAIL_ADDR, LASTUPDOPRID, TO_CHAR(CAST((LASTUPDDTTM) AS TIMESTAMP),'YYYY-MM-DD-HH24.MI.SS.FF') FROM PS_ZG_ENT_KC_VW WHERE ZG_ENTITY_ID=:1 AND EMPLID=:2 AND EFFDT=TO_DATE(:3,'YYYY-MM-DD') AND EFFSEQ=:4 FOR UPDATE OF EFFDT, PHONE, LASTUPDOPRID, LASTUPDDTTM
value=V0000001
value=7269555value
10-07-15
value=0