Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Handle column unknown error after field is deleted from database table

edited April 2013 in General
Hi,

A customer has deleted a field from a table not realizing it had a
relation with some of the reports build in the past. Although the field
is not used in the report, it is retrieved from the database.
Running the report without modifications gives us a dynamic sql error
'column unknown' (using ibx).

Can I somehow remove this field from data views automatically after a
report template is loaded? This would be a huge help.


Kind regards,

Jeroen Röttink
JR-soft software solutions

Comments

  • edited April 2013

    You can implement some code for the Report.Template.OnLoadEnd event to
    iterate over the QueryDataViews and use SQLBuilder to remove the field from
    the SelectFields[ ] list.

    1. Here is an rbWiki 'How To' example for iterating over the DataViews

    http://www.digital-metaphors.com/rbWiki/DADE/Fundamentals/How_To...Search_Available_Dataviews

    2. The RBuilder Help topics for TdaSQLBuilder and its subtopics contain
    code examples and there are examples on rbWiki as well. It would be
    something like this...

    lSQLBuilder := TdaSQLBuilder.Create(myDataPipeline);


    lSQLBuilder.SelectFields.Remove(aTableNameOrAlias, aFieldNameOrAlias);
    lSQLBuilder.ApplyUpdates;

    lSQLBuilder.Free;


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.