// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // ! 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. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer count,i,j,k,idx,ok1,ok2; string charnamelist,charname[],str_minval[],str_maxval[],experlist,expername; string methodlist,method; integer searchneg,useor; DIALOG dlg; string key; float minval[],maxval[]; CHARSET cs; float vl; for i=1 to DbGetExperCount do if dbGetExperClass(i)="CHR" then { if length(expername)=0 then expername=DbGetExperName(i); experlist=experlist+DbGetExperName(i)+" "; } DlgAddText(dlg,"Select character type:",15,15,150,15); DlgAddList(dlg,experlist,expername,15,35,150,150,"LIST"); if not(DlgShow(dlg,"Query by character value",280,217)) then stop; charnamelist=""; for i=1 to ChrSetGetCount(expername) do charnamelist=charnamelist+ChrSetGetChar(expername,i)+" "; DlgReset(dlg); methodlist="Add to list Replace list Search in list"; method="Add to list"; DlgAddText(dlg,"Selection method:",15,192,150,15); DlgAddList(dlg,methodlist,method,15,210,150,53,"LIST"); DlgAddCheck(dlg,"Negative search",searchneg,30,150,150,15); DlgAddCheck(dlg,"Combine using OR",useor,30,168,150,15); DlgAddText(dlg,"Character name",15,15,100,15); DlgAddText(dlg,"Min. val.",175,15,50,15); DlgAddText(dlg,"Max. val.",235,15,50,15); count=4; for i=1 to count do { charname[i]="";str_minval[i]="";str_maxval[i]=""; DlgAddList(dlg,charnamelist,charname[i],15,15+i*24,150,200,"DROP"); DlgAddEdit(dlg,str_minval[i],175,15+i*24+2,50,16); DlgAddEdit(dlg,str_maxval[i],235,15+i*24+2,50,16); } ok1=0; while not(ok1) do { if not(DlgShow(dlg,"Select entries according to characters",300,300)) then stop; ok1=1; // if length(expername)=0 then ok=0; } for i=1 to count do { minval[i]=-1001; if length(str_minval[i])>0 then minval[i]=val(str_minval[i]); maxval[i]=-1001; if length(str_maxval[i])>0 then maxval[i]=val(str_maxval[i]); } for i=1 to DbGetEntryCount do { key=DbGetEntryKey(i); if method="Replace list" then DbSetSel(key,0); if (method<>"Search in list") or DbGetSel(key) then { ChrLoad(cs,key,expername); ok1=1;if useor then ok1=0; for j=1 to count do if length(charname[j])>0 then { ok2=0; idx=ChrFindName(cs,charname[j]); if (idx>0) and (ChrGetPresent(cs,idx)) then { ok2=1; vl=ChrGetVal(cs,idx); if (minval[j]>-1000) and (minval[j]>vl) then ok2=0; if (maxval[j]>-1000) and (maxval[j]