// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! This script is provided "as is" by Applied Maths. ! // ! You are free to use and modify this script for your own needs. ! // ! Redistribution or reproduction of the script is prohibited. ! // ! DISCLAIMER: ! // ! Improper use of scripts may corrupt your database. ! // ! Running this script is entirely at your own responsibility. ! // ! Applied Maths accepts no lialibility for any consequences ! // ! resulting from its use. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DIALOG dlg; string fieldlist,fromfield,tofield,key; integer i,x,ok,selonly; for i=1 to DbGetFieldCount do fieldlist=fieldlist+DbGetFieldName(i)+" "; DlgAddText(dlg,"From:",15,15,250,15); DlgAddList(dlg,fieldlist,fromfield,15,40,250,150,"LIST"); DlgAddText(dlg,"To:",300,15,250,15); DlgAddList(dlg,fieldlist,tofield,300,40,250,150,"LIST"); DlgAddCheck(dlg,"Current selection only",selonly,15,210,150,15); ok=0; while not(ok) do { x=DlgShow(dlg,"Copy field",570,320); if x=0 then stop; ok=1; if (ok) and (fromfield="") then { message("You should specify a 'from' field"); ok=0; } if (ok) and (tofield="") then { message("You should specify a 'to' field"); ok=0; } if (ok) and (tofield=fromfield) then { message("The fields 'from' and 'to' should be different"); ok=0; } } DlgReset(dlg); DlgAddText(dlg,"IMPORTANT WARNING: any data in the field '"+tofield+"' will be permanently lost!~n~nOK to proceed?",15,15,350,40); if not(DlgShow(dlg,"Confirmation",400,200)) then stop; setbusy("1"); for i=1 to DbGetEntryCount do { if i/20=floor(i/20) then setbusy(str(i,0,0)); if i/200=floor(i/200) then dbsavefields; key=DbGetEntryKey(i); ok=0; if not(selonly) then ok=1; if not(ok) then if DbGetSel(key) then ok=1; if ok then DbSetField(key,tofield,DbGetField(key,fromfield)); } dbsavefields;