Referencing fields as pipelinename['fieldname'] should give a error if the field or pipe does not exist. This is important if the dataset SQL is changed.
Can there perhaps be a property on the report to set strict?
Thanks for the feedback. Are you referring to a compiler error or runtime error? An error is given at runtime when the field name is incorrect however it is not very descriptive. We will look at providing a more useful runtime error when a field name does not exist.
I do not believe Delphi gives a compiler error when field names are incorrect but we'll add this to our list of possible enhancements for RAP.
This is working as designed. After further research, the error I was receiving in my test app was due to a type mismatch and was not directly related to the incorrect field name per se. We will consider adding a descriptive runtime error to RAP when the field name is not found for a future release of ReportBuilder.
For checking reports after a database redesign I used following code to find fields referencing obsolete database fields. Maybe it's of use for you.
class procedure TDigitalMetaphors.DetectMissingFields(const AReport: TppCustomReport; const AReportName: string); var Datapipeline: TppDataPipeline; SubReport: TppSubReport; Component: TppComponent; ComponentName: string; SubReportName: string; BandIdx: integer; ObjIdx: integer; Band: TppBand; begin // #1626 iterate bands, design layers and subreports. Crosstab is not checked for BandIdx := 0 to AReport.BandCount-1 do begin Band := AReport.Bands[BandIdx]; for ObjIdx := 0 to Band.ObjectCount-1 do begin Component := Band.Objects[ObjIdx]; if (Component is TppSubReport) then begin SubReport := TppSubReport(Component);
if (AReportName <> '') then SubReportName := AReportName + '.' + SubReport.UserName else SubReportName := SubReport.UserName;
// recursive into subreport DetectMissingFields(SubReport.Report, SubReportName); end else if Component.IsDataAware then begin Datapipeline := Component.DataPipeline; if Assigned(Datapipeline) and (Component.DataField <> '') then begin if not Assigned(DataPipeline.GetFieldForName(Component.DataField)) then begin // generate error if (AReportName <> '') then ComponentName := AReportName + '::' + Band.GetDescription + '::' + Component.UserName else ComponentName := Band.GetDescription + '::' + Component.UserName;
raise EUserException.CreateFmt('%s contains a reference to %s.%s', [ComponentName,Datapipeline.Name,Component.DataField]); end; end; end; end; end; end;
Comments
Thanks for the feedback. Are you referring to a compiler error or runtime error? An error is given at runtime when the field name is incorrect however it is not very descriptive. We will look at providing a more useful runtime error when a field name does not exist.
I do not believe Delphi gives a compiler error when field names are incorrect but we'll add this to our list of possible enhancements for RAP.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Have I got that right?
Lawrence
Lawrence
DBTEXT objects.
It printed / previewed with no errors messages showing.
Lawrence
This is working as designed. After further research, the error I was receiving in my test app was due to a type mismatch and was not directly related to the incorrect field name per se. We will consider adding a descriptive runtime error to RAP when the field name is not found for a future release of ReportBuilder.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Are you confirming that this behaviour does not happen in the current version.
Is there a patch that I might have to do it?
Thank you
Lawrence
Jeroen Röttink
JR-soft software solutions