Rap error after moving from 7 to 7.02.
After upgrading from 7 to 7.02 I get a variant conversion error on RAP
code that ran fine with 7. I have this problem in a detail band
BeforePrint. The error is occuring on the following line.
if Report.DataPipeline['SampleType'] = 'rtTargetStandard' then
I set a breakpoint in my custom pipeline's OnGetFieldValue. The error
occurs before this breakpoint.
Any ideas on where to look for the problem?
Thanks,
Joanne
code that ran fine with 7. I have this problem in a detail band
BeforePrint. The error is occuring on the following line.
if Report.DataPipeline['SampleType'] = 'rtTargetStandard' then
I set a breakpoint in my custom pipeline's OnGetFieldValue. The error
occurs before this breakpoint.
Any ideas on where to look for the problem?
Thanks,
Joanne
This discussion has been closed.
Comments
pipeline in delphi to view the field editor to select the TppField in the
object inspector. Then try a
ShowMessage(Report.DataPipeline['SampleType']); in RAP to see if it returns
as a string.
Should your code be unquoted on the type?
if Report.DataPipeline['SampleType'] = rtTargetStandard then
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
information is not available at design time. I have a simple program that
uses TppDesigner to edit the rtm.
My custom pipeline has only string fields. Below is the code used to
create the TppField. This method is called with aFieldName of
'SampleType'.
procedure TITPipeline.CreateField(const aFieldName: string; aPosition:
integer);
var
lField: TppField;
begin
lField := TppField.Create(nil);
lField.Name := Name + aFieldName;
lField.FieldName := aFieldName;
lField.FieldAlias := aFieldName;
lField.FieldLength := 5;
lField.DisplayWidth := 5;
lField.DataType := dtString;
lField.Position := aPosition + 1;
lField.Alignment := taLeftJustify;
lField.DataPipeline := self;
end;
This value is coming back as zero in the show message. If I put a
TppDBText on the report and set it's DataField property to 'SampleType',
the correct value prints on the report.
Joanne
call to get the field value to see what is happening. Most likely, the data
is an integer or some other type and when you have a TppField of type
dtString and try to print a number, you'll often get a 0. Another test you
can perform on your pipeline is to leave RB out of the equation and simply
try to print data manually on a form by calling the methods to open the
pipeline, traverse the data and print records to a memo control on a form.
This way you can evaluate if you can pull strings out of your pipeline
fields with the minimal code involved.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
shown in the ShowMessage in the DetailBandBeforePrint RAP code. It is the
text string 'rtTargetStandard'. This is the correct value for this field.
Where do I look to find out why the field value is correct for the
TppField and not correct for the RAP code?
I have verified that neither my pipeline's GetFieldValue or
GetFieldAsString are called while the rap code is running.
Joanne
The TppField printing the SampleType field is DBText1. I put the
following code in DbText1OnGetText
ShowMessage(report.DataPipeline[DbText1.DataField]);
ShowMessage(Text);
The first dialog always shows 0. The 2nd shows strings that are valid
SampleTypes.
Joanne
value. Then place a breakpoint in your pipeline's get field methods to see
which one it is calling. This way you can work backwards through the call
stack to see where the datatype is not being evaluated properly. Instead of
using RAP code, code a simple Delphi event handler for this report.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
isolates the Report Builder specific code. This makes duplicating a
problem outside of the application a challenge. This report is very
simple so I decided to try re-creating the report. I now get same value
in Rap code as I do when displaying the value with a TppDbText.
Joanne
know and send us an example-Thanks.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com