PROGRAM Check_Item_Length; {-- *************************************************************************** -- ** Descr. : searches items with specified name and check their length -- ** (max length and query length) properties. Report all items -- ** violating this length -- *************************************************************************** -- ** 26/12/01 1.001.00 Initial Creation, muellers@orcl-toolbox.com -- ***************************************************************************} VAR frm : number; files : TStringList; items : TStringList; filename : varchar2; ps : TParamScreen; pb : TParamBoard; j : number; i : number; itmpath : varchar2; itm_name : varchar2; itm_length : number; BEGIN //build a nice parameterscreen ps := TParamScreen.create; pb := ps.AddBoard('Modules',picModules); pb.addparam(parLabel,'MYLABEL','This script will search Item-Fields and check them to be of specified length','',''); pb.addparam(parPathname,'SRCPATH','Source Path','',''); pb.addparam(parString,'ITMNAME','Item Name','',''); pb.addparam(parInteger,'ITMLENGTH','Item Length','30',''); if ps.ShowParamScreen('Check Item lengths ...') then begin //get the values specified on the parameterscreen itm_name := ps.Paramvalue('ITMNAME'); itm_length := to_number(ps.Paramvalue('ITMLENGTH')); //get all *.fmb files from the sourcepath specified on the parameterscreen(including subdirectories) files := GetFileList(ps.ParamByName('SRCPATH').value,'*.fmb', true); //loop thorough all files found for j := 0 to files.count-1 do begin //get the filename from the array filename := files.strings[j]; logadd('Checking ('+to_char(j+1)+'/'+to_char(files.count)+') '+filename); // try to load the form try frm := API_LoadModule(filename); //get all item objects items := API_GetAllItemObjects(frm); //loop through all item objects for i := 0 to items.count-1 do begin //is the objectname matching our searchitem name? if API_GetObjectName(items.objects[i])=itm_name then begin //get the objectsname inclusive blockname, etc itmpath := API_GetObjectPath(items.objects[i]); //is the length different than what it should be ?! if generic_getNumProp(items.objects[i],D2FP_MAX_LEN) <> itm_length then begin logadd(itmpath + ' Length='+to_char(generic_getNumProp(items.objects[i],D2FP_MAX_LEN))); end; //is the query length different than what it should be (which is only a violation if it is smaller then maxlen) ?! if generic_getNumProp(items.objects[i],D2FP_QRY_LEN) < itm_length then begin logadd(itmpath + ' Query='+to_char(generic_getNumProp(items.objects[i],D2FP_QRY_LEN))); end; end; end; //free the items-list from memory items.free; //free the forms module from memory API_DestroyModule(frm); except //output the error if something happened logadd(' =>'+GetError , LogError); end; end; end; //free the parameterscreen from memory ps.free; END.