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

JIT How do I reference the data

edited March 2005 in End User
I am delivering an end user reporting system with RB7. There are columns
that the user will want to add that are going to be way to difficult for
them to come up with. Calculated fields, from other tables.

My plan is to add a JIT control. This way when they add a database field
they can choose that pipeline, and pick the calculated field.

In the JIT pipeline control I added the TppField controls. Example
'Remaining Balance'.

In the event OnGetFieldValue is where I assume I put the calculated value.

I can set the result to a value and that works. It shows up on the report.

The problem is calculating the 'Remaining Balance' I need the current
CustomerID.

How do I reference the data that was setup on the Data tab? I can do the
following:
daADOQueryDataView1.GetDataModule.FindDataViewByUserName('Query_tblCustomer').DataPipelines[0].Fields[0].Value;

But I don't like this for a number of reasons. They could change the
dataview to XXXDataView2, and the table could be 'Query_tblCustomer2' if
they add the table, add it again and delete the first table.

How do I generically reference the DataSource?

Also, is there any way to get the JIT fields to show up in a preview? They
don't have to be the correct values, but could be place holders to show what
it would like ( $99999.99)

Thanks,
Rob

Comments

  • edited March 2005
    I was looking in the wrong area. I found the answer in the DADE tips. I am
    a little worried that there could be more than one DataView, but I am going
    to ignore it for now.

    I am still interested in the second part of my question.



    function TfrmReports.GetQueryForReport(aReport: TppReport): TADOQuery;
    var
    lDataModule: TdaDataModule;
    lDataView: TdaADOQueryDataView;
    begin
    Result := nil;

    lDataModule := daGetDataModule(aReport);

    if lDataModule.DataViews[0] is TdaADOQueryDataView then
    lDataView := TdaADOQueryDataView(lDataModule.DataViews[0]);

    if lDataView.DataSource.DataSet is TADOQuery then
    Result := TADOQuery(lDataView.DataSource.DataSet);
    end;



This discussion has been closed.