Home General

Generate report error on missing datafield from reporting component

edited April 2019 in General
I am in the process of adapting lots of reports after a database redesign.
To make the process of updating these reports easier some database views are created.
When I use such a view in DADE replacing some obsolete tables and fields, report components are still referencing the old datafield even if I keep the field alias in the query designer the same. Reason is probably that the field names differ, and this is stored in the report component as datafield.
So I need to change the datafield name in the report component as well. And here the errors occur. When a field is not changed, it will just print empty. Is it possible to generate an error (raise an exception) when a component references a field that doesn’t exist? I need to make sure all references are correct.
Making a change to the source is no problem.
Kind regards,

Jeroen Röttink
JR-soft software solutions

Comments

  • Hi Jeroen,

    One option is to implement a function that iterates over the Report.Bands[ ].Objects[ ] and for data-aware components checks DataPipeline.GetFieldForName(DataField) = nil.

    Another option is to create a .txt file of field mappings OldFieldName=NewFieldName and then write code to do a search and replace on the .rtm text. (We have used this in the past to convert some of our demos. FireDAC includes a utility like this that is used to convert BDE apps to FireDAC).


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • Thanks. The first option works fine when also considering TppSubreport.
    Kind regards,

    Jeroen Röttink
    JR-soft software solutions
Sign In or Register to comment.