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

Losing Calculated Pipeline Fields in Custom Data Template

edited September 2003 in End User
I am using RB7.03 on Delphi5
I have created some custom dataviews with ADO connections.
I have based the creation of my templates on the examples given in the
Custom DataViews demo
In these custom dataviews I have a number of Calculated TFields which are
created along with associated PipelineFields (as it does in the TdvInvoice
example)

I create my autosearch fields in the overriden CreateSearchCriteria (called
in SetReport). The code is shown below.

lMainReport := TppReport(Report.MainReport);

{ create autosearch criteria }
lMainReport.CreateAutoSearchCriteria(DataPipeline.Name, 'ClientCode',
soEqual, '', True);
lMainReport.CreateAutoSearchCriteria(DataPipeline.Name, 'TradeDate',
soBetween, '', True);

This all works well when I select the dataview template and it shows me all
the fields in the data designer.

If I then click over to the Design tab and back again to the data tab the
Calculated fields (pipeline fields) are gone? Strange but True.

I have also tried replacing the Report.CreateAutoSearchCriteria calls with
plain SQL.AddCriteriaField and setting the AutoSearch property to True. This
allows the fields to persist in the data pipeline but when I execute the
saved report I get a message "Cannot use empty object or column names. Use a
space"

I can not work out what is going on.
Any help would be appreciated

Kind regards,

Jarrod

Comments

  • edited September 2003
    Hi Jarrod,

    Can you reproduce the problem with our invoice custom dataview template
    demo? The ItemTotal calc field seems to always be there after switching from
    the design tab back to the data tab. If you have to modify the demo to
    reproduce the problem, send use a modified version to
    support@digital-metaphors.com and we'll take a look at it. When are you
    creating the calculated TField object?


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited September 2003
    Ahhh... discovered my problem. I had to override RefreshQuery and just put
    in a SQLChanged call so that I did not lose the pipelinefields that I had
    created.

    Seems be OK? Are there any other calls I should put in there?

    J.

  • edited September 2003
    Hi Jarrod,

    SQLChanged should cause it to refire the query the next time data is
    requested as it closes the query and reassigns the SQL text. I think you are
    recreating the datapipeline fields so you will have to call that in the
    RefreshQuery override. If it works, then that should be it. I'd have to have
    a running example in order to give a more definitive answer to what could be
    going on in your custom dataview classes:) If you run into another problem
    feel free to send an example to support@digital-metaphors.com

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.