RAP Runtime "Color-Coding Components"
Hi,
RAP Runtime example does not work which is illustrated on page 359 of
Developer Guide. Title "Color-Coding Components", I want to use same
technique in changing "DisplayFormat" when report is running. I followed
each step but no use.
Could somebody tell me what I am missing.
Finally I want to say one thing for "Report Builder" is that it is not as
powerfull tool as I thought of it. This Tool have let me down several times.
Above is one of the other example.
Anyway, please somebody help me,
Thanks in advance,
maaz rizki
RAP Runtime example does not work which is illustrated on page 359 of
Developer Guide. Title "Color-Coding Components", I want to use same
technique in changing "DisplayFormat" when report is running. I followed
each step but no use.
Could somebody tell me what I am missing.
Finally I want to say one thing for "Report Builder" is that it is not as
powerfull tool as I thought of it. This Tool have let me down several times.
Above is one of the other example.
Anyway, please somebody help me,
Thanks in advance,
maaz rizki
This discussion has been closed.
Comments
In my testing with ReportBuilder 9.03 and Delphi 7, I was able to
successfully change the DisplayFormat of a DBText component in the
DetailBand.BeforePrint event in RAP. My test application used the DBDEMOS
database and the Orders table. I displayed the AmountPaid field in the
detail band and in the BeforePrint event in RAP, I added the following
code...
begin
if(orders['AmountPaid'] < 2000) then
DBText1.DisplayFormat := 'test'
else
DBText1.DisplayFormat := '#';
end;
This changed the display format based on my conditions.
We are very sorry that you feel this way about our product. Please let us
know any issues you currently have and we will try to fix/provide a
workaround for them as quickly as possible.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Okay whats wrong with this code
var
liLength:integer;
lsString:String;
begin
lsString:=DBPipeline1['ISBN'];
liLength:=Length(lsString);
{ for 12 digit UPC eg: 1 12345 12345 1}
if (liLength=12) then
DBText1.DisplayFormat := '0\ 00000\ 00000\ 0;0';
DBText1.Color := clRed;
end;
{ for 13 digit or any thing between 7 or higher but 12 or 6 digits
UPC eg: 1 123456 12345 1 }
if ((liLength>6) and (liLength<>12)) then
DBText1.DisplayFormat := '0\ 000000\ 99999\ 99999;0';
DBText1.Color := clYellow;
end;
{ for any number with 6 or less then 6 digit UPC}
{ eg: 123456}
if (liLength<=6) then
DBText1.DisplayFormat := '000000;0';
DBText1.Color := clRed;
end;
Above code just take the first format string it sees and applies to whole
report, even colors do not change
Please help,
Is this the actual code you are entering into RAP? If it is, I believe you
need to start your if blocks with a "begin" statement in order for the
compiler to recognize them correctly. One thing I always do, especially
when creating conditional RAP code, is first code the event in Delphi so it
can be debugged easily, then once it is working correctly, move the code to
RAP.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
complained. Anyway, it is working except for color change. The color change
is not taking effect.
Now the code look like this,
Procedure DetailBeforePrint;
var liLength:Integer;
lsString:String;
begin
lsString:=DBPipeline1['ISBN'];
liLength:=Length(lsString);
{ for 12 digit UPC eg: 1 12345 12345 1}
if (liLength=12) then begin
DBText1.DisplayFormat := '0\ 00000\ 00000\ 0;0';
DBText1.Color := clRed;
end;
{ for 13 digit or any thing between 7 or higher but 12 or 6 digits
UPC eg: 1 123456 12345 1 }
if ((liLength>6) and (liLength<>12)) then begin
DBText1.DisplayFormat := '0\ 000000\ 99999\ 99999;0';
DBText1.Color := clYellow;
end;
{ for any number with 6 or less then 6 digit UPC}
{ eg: 123456}
if (liLength<=6) then begin
DBText1.DisplayFormat := '000000;0';
end;
end;
Once again thanks,
did you tried out
DbText.Font.Color:=clRed...
chris
www.eulanda.com
Yes, Chris is correct. Try setting the DBText.Font.Color instead of the
DBText.Color property.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
it is background we are tyring to change. Just as mentioned in example.
Make sure that Transparent is set to False, When Transparent is set to True
(the default), the Color will never be used to render the element.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com