需要根据通过组件接口进入文件的数据来更新/插入和删除现有表中的数据。虽然我写了下面的代码但没有信心,如果有其他方法可以执行相同的操作,请告诉我。代码 -
&Osession = %session
&Ocipersonaldata = &osession.getcompintfc.(compintfc.ci_prsonal_data);
&Ocipersonaldata.interactivemode = true;
&Ocipersonaldata.gethistoryitems= false;
&Ocipersonaldata.edithistoryitems= false;
&Ocipersonaldata.keypropemplid= d_persnid_aet.emplid
&Opersnidcollection = Ocipersonaldata.coll_pers_nid;
&Found =false;
For &I = 1 to Opersnidcollection.count
&Opersnid = Opersnidcollection.item(&I);
If Opersnid.country= d_persnid_aet.country and &opersnid.nationalid_type =d_persnid_aet.nationalid_type then
If d_persnid_aet.actn = 'delete'
Sqlexec(delete from ps_persnid where emplid =:1 and country =:2 and nationalid_type =:3",d_persnid_aet.emplud,d_persnid_aet.country,d_persnid_aet.nationalid_type);
Else
If d_persnid_aet.actn = 'insert' then
&Pernid = &persnidcollection.item (persnidcollection.count);
&Pernid.nationalid= d_persnid_aet.nationalid;
Else
&Persnid =persnidcollection.insertitem(persnidcollection.count);
&Pernid.nationalid= d_persnid_aet.nationalid;
&Pernid.country= d_persnid_aet.country;
&Pernid.nationalid_type d_persnid_aet.nationalid_type
End-if;