الفلترة باكثر من خيار
#3
(13-11-2018, 01:03 PM)B.M.AbdelAziZ كتب : السلام عليكم

عليك بمجموعة من الجمل الشرطية if ... then
يمكن ان تستفيد من موضوع سابق:

[تمرين] فلترة بيانات جدول حسب الشهر في سنة معينة
http://delphi4arab.net/forum/showthread.php?tid=338

وعليكم السلام ورحمة الله اخي العزيز 
انا استخدم هذا الكود ولكن لا يعمل ولا اعلم لماذا
كود :
procedure Tfrmmain.SpeedButton1Click(Sender: TObject); var ch1,ch2,ch3:Boolean; a,b,c,ab,ac,bc,abc:string; begin ch1:=checkbox1.Checked; ch2:=checkbox2.Checked; ch3:=checkbox.Checked; a:='codofperson ='+QuotedStr(edtgiab1.Text); b:='themonth ='+QuotedStr(cobgiab1.Text); c:='theyeare ='+QuotedStr(cobgiab2.Text); ab:='codofperson ='+QuotedStr(edtgiab1.Text)+'and themonth ='+QuotedStr(cobgiab1.Text); ac:='codofperson ='+QuotedStr(edtgiab1.Text)+'and theyeare ='+QuotedStr(cobgiab2.Text); bc:='themonth ='+QuotedStr(edtgiab1.Text)+'and theyeare ='+QuotedStr(cobgiab2.Text); abc:='codofperson ='+QuotedStr(edtgiab1.Text)+'and themonth ='+QuotedStr(cobgiab1.Text)+ 'and theyeare ='+QuotedStr(cobgiab2.Text); if ch1=true and ch2=true and ch3=true then begin tabel1.Filtered:=true; tabel1.Filter:=abc; end; if ch1=true and ch2=true then begin tabel1.Filtered:=true; tabel1.Filter:=ab; end; if ch1=true and ch3=true then begin tabel1.Filtered:=true; tabel1.Filter:=ac; end; if ch2=true and ch3=true then begin tabel1.Filtered:=true; tabel1.Filter:=bc; end; if ch1=true then begin tabel1.Filtered:=true; tabel1.Filter:=a; end; if  ch2=true  then begin tabel1.Filtered:=true; tabel1.Filter:=b; end; if ch3=true then begin tabel1.Filtered:=true; tabel1.Filter:=c; end; if tabel1.IsEmpty then begin  tabel1.Filtered:=false;  ShowMessage('لم يتم العثور على نتيجة'); end; end;
الرد


الردود في هذا الموضوع
RE: الفلترة باكثر من خيار - بواسطة احمد العراقي - 14-11-2018, 12:41 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم