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

Passing Values from DataModule in app to AutoSearch fields on Report

edited March 2003 in RAP
Please excuse what must be a very basic question but after years of using
Quickreports and QRDesign I am converting to RB!!

This is what I want to do.

I have a set of reports that can be printed for the currently selected
record in the database. These reports are customisable and can be added to
by the user so I am trying to design them so that all the work is done by
the report to save me having to add code as new versions of reports are
required.

I first started by using a DBPipeline that was linked to the datasource in
the app but then found that I couldn't then link that to other data piplines
created in the report

In my QRDesign days I could create a query with a parameter that I would
then set in a BeforeOpenQuery event in the app. The value of the parameter
would be drawn from the dataset in the app and passed to the report. I used
to use parameter names that I could check for and if they existed in the
report I would pick up the data from the dataset as appropriate.

I have tried doing this with the ReportOnGetAutoSearchValues event but the
code in this is something like

Report.AutoSearchFields[0].Value
:=LeadsData.LeadsSource.DataSet.FieldByName('LeadNumber').Value;

When I compile this I get a message saying that LeadsData is unknown. So is
there an equivalent of a Uses clause for a report for use in RAP? Or is
there a better way of acheiving what I want.

TIA

Rhonda Ridge

Ab Initio Software

Comments

  • edited March 2003
    There is no uses clause for RAP exactly. RAP is a runtime interpreter which
    we have custom coded. RAP only knows about published properties for
    registered classes and special RapRTTI classes are needed to provide public
    member visibility for our RB classes. There is a way to extend RAP. To do
    what you want, you need to code a RAP pass through function called LeadsData
    where you pass 'LeadNumber' as the string parameter. The function will
    return the field value for the autosearch field value. There are tutorials
    and demos to create RAP pass through functions in the Developer's Guide,
    RAP.hlp file, and in the installed ..\RBuilder\Demos\RAP folder. Take you
    time and create a simple parameterless RAP pass through example and then
    work your way up to a parameterized example. The parameters are not as
    complicated. Remember the result parameters is the next index after the
    incoming function parameters in the parameter list of the ExecuteFunction
    routine of your pass through function class.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.