Hi,
have you ever needed to delete the fields of a table with hundreds of columns that were actually unused (i.e., empty or zero)?
Here is the function that will INSTANTLY allow you to remove the columns without values:
sub ClearFields(tName) //pass the table name AFTER a Load *...
let cancellati=0;
let totfield=NoOfFields('$(tName)');
let vElenco='';
for i=0 to totfield
let vFName = PurgeChar(FieldName($(i),'$(tName)'),'[]"');
let vCnt=FieldValueCount('$(vFName)');
if vCnt=1 then
vElenco = vElenco & ',[$(vFName)]';
let cancellati=cancellati+1;
end if
next i
if cancellati>0 then
vElenco = mid(vElenco,2);
drop fields $(vElenco) from $(tName);
trace Tabella $(tName): cancellati $(cancellati) campi su $(totfield) iniziali presenti;
else
trace Table $(tName): nessun campo eliminato su $(totfield);
end if
end sub