PROGRAM ReportsAPI_PLSQL; {-- *************************************************************************** -- ** Descr. : This script will show how to find and change a AfterParameterForm -- ** trigger. This tutorial script changes the PL/SQL function by -- ** adding a comment line to the sourcecode! -- ** -- ** MINVERS: requires FormsAPI Master 1.0 Build 250 and up -- *************************************************************************** -- ** 17/03/02 1.001.00 Initial Creation, muellers@orcl-toolbox.com -- ** 16/02/03 1.002.00 Total rewrite, no more REX file parsing, now works with -- ** internal ReportsAPI, muellers@orcl-toolbox.com -- ***************************************************************************} VAR ps : TParamScreen; pb : tparamboard; rep,rtr,apf : number; filename : varchar2; src : varchar2; //Start Main Program BEGIN //build the parameterscreen ps := TParamScreen.create; pb := ps.AddBoard('Reports Labelchanger Tutorial',picOptions); pb.addparam(parLabel,'MYLABEL','Please select the Report file where the PL/SQL should be changed:','',''); pb.addparam(parFileName,'MYFILE','Source','','Reports (*.rdf)|*.rdf|All Files *.*|*.*'); //show parameterscreen if ps.ShowParamScreen then begin filename := ps.paramvalue('MYFILE'); logadd('Processing '+filename); rep := RepAPI_LoadModule( filename ); rtr := RepGeneric_GetObjProp(rep,D2RP_REP_TRIGGER); apf := RepGeneric_GetObjProp(rtr,D2RP_REP_APFORM_OBJ); if apf = 0 then begin logadd('No AfterParamForm trigger found'); end else begin //found one ... so let's change it! src := RepAPI_GetPLSQL(apf); src := src+C_CR+'--Test!'; RepAPI_SetPLSQL(apf,src); end; //now construct a new filename like NEW_???.rdf filename := extractfilepath(filename)+'new_'+extractfilename(filename); RepAPI_SaveModule(rep,filename); RepAPI_FreeModule(rep); end else begin logadd('pressed cancelbutton on parameterscreen!'); end; ps.free; END.