QuickReport report displays different content according to field values

xiaoxiao2021-03-17  193

Today, I encountered a question when using QuickReport to make a report, I want to load different pictures according to the value of the field, and there are multiple records in this data set, before preview

While Not Eof Dobegin

END;

To do it, you can display the records, but the picture is the same picture, it seems to be judged according to the first record, trying to put the code in other places. Later, I saw the example of others, I understood

To write this code in the BeforPrint event in Subdetail, do not handle this loop. code show as below

Procedure TfocReportvoucherform.QRSUBDetail1beforeprint (Sender: tqrcustom); var ipath: string; begin with query2 do begin

// while not eof do // remove this can normally shows begin if FieldByName ( 'Design'). AsString = 'Y' then FocReportVoucherForm.QRIzz.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm. Qrizz.Picture.LoadFromFile (iPath 'icon / unchecked.bmp ");

if FieldByName ( 'Film') AsString = 'Y' then FocReportVoucherForm.QRIsc.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIsc.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

if FieldByName ( 'Proof') AsString = 'Y' then FocReportVoucherForm.QRIdy.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIdy.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

if FieldByName ( 'DigitalPrint') AsString = 'Y' then FocReportVoucherForm.QRIsmky.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIsmky.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

if FieldByName ( 'CTP') AsString = 'Y' then FocReportVoucherForm.QRIzzzb.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIzzzb.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').; if FieldByName ( 'Printing') AsString = 'Y' then FocReportVoucherForm.QRIys.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIys.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

if FieldByName ( 'NormalProof') AsString = 'Y' then FocReportVoucherForm.QRIcgdy.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIcgdy.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

if FieldByName ( 'SpotColor') AsString = 'Y' then FocReportVoucherForm.QRIzs.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIzs.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').; if FieldByName ( 'DigitalProof') AsString = 'Y' then FocReportVoucherForm.QRIsmdy.Picture.LoadFromFile (iPath 'icon / checked.bmp') else FocReportVoucherForm.QRIsmdy.Picture.LoadFromFile (iPath 'icon / unchecked.bmp').;

// NEXT; END; END;

转载请注明原文地址:https://www.9cbs.com/read-129739.html

New Post(0)