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

How to add parameters to a report using the Designer?

edited June 2003 in End User
Hi Jim,

I'm trying to implement the new parameters feature of your new 7.02 release.
I know how to read and set parameters at runtime in Delphi. And I know how
to access the parameter values inside the report template using RAP. The
only thing I haven't figured out yet is how an enduser will be able to add a
parameter (predefined, of course) to a report using the report designer. Is
this possible? If so, how can we do this?

Thanks for your help,
-Andy

Comments

  • edited June 2003
    You can use RAP to access parameters as an end user. There is no end user UI
    to set them. You can always show your own custom dialog from RAP called from
    a RAP pass through function. There are examples of creating RAP pass through
    functions in the RAP help file, tutorials and demos.

    What are you trying to do?

    Are you trying to change the dataset? Use Autosearch to do this, not
    Parameters. Parameters are useful when you have info you want to apply to
    some conditions in the report before you run the report. You should set the
    parameters behind the scenes, via RAP. The user shouldn't set the them
    directly through the UI. Parameters are very useful in the Report Server
    Edition.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    I'm trying to pass some header information to the report, such as meeting
    name and association name. The code I'm converting from Crystal was
    retrieving the parameter names from the report at runtime within Delphi.
    Then depending on the name of the parameter, it would set the value to the
    respective global variable. We are already using Autosearch to change the
    dataset for some fields and that works well.

    Since there are only a few of these header-type variables that the reports
    would ever need, I suppose I could always set these before running the
    report. If the end user needs these values when designing the report, they
    could retrieve the information from within RAP.

    I think this will work for us. Thanks for your help, Jim.

    -Andy

  • edited June 2003
    The easiest way to do this is to provide this data through a JITPipeline.
    Then your user doesn't need RAP code for this, they just need to select the
    JITPipeline and connect it to DBTexts in the header. Make the JITPipeline a
    one record pipe that is not connected to any report. This way you can
    reference these values in any band, report, or subreport.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    That works great, Jim. Thanks for your help.

    -Andy

  • edited June 2003
    Whoops, I spoke too soon. The OnGetFieldValue event for my JITPipeline
    seems to be firing 20 times before the report will print. There is about 20
    records in my report, so it seems to be hitting it for every record. I
    dropped the DBText fields from the JITPipeline into the header band (once),
    so I expect the event to be hit only once for each field. Is there another
    property that I need to set in order for the OnGetFieldValue event to
    processed once for each field occurance?

    Thanks,
    Andy

  • edited June 2003
    Make sure that the Report.PassSetting is set tp psOnePass. It sounds as if
    what is happening is that you are using a two pass report, so it makes a
    pass through the data paginating the report in the first pass before the
    first page is generated to a device.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    Pass Setting is set to One Pass. If I set it to Two Pass, then it hits the
    OnGetFieldValue event 46 times for one JIT field in the header. Any other
    ideas what I could be doing wrong?

    Thanks,
    Andy

  • edited June 2003
    I created an example and yes,this does fire a lot. There is no optimization
    in RB not to fire this event handler. What is happening is that the report
    engine is telling all the components that a traversal has occured. This is
    mainly for the calc components to calculate a new value for the new record.
    Because this is hooked up to a dbText, this tries to get a new value from
    the JITPipeline, triggering the OnGetFieldValue, eventhough there is only
    one record in the JIT.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    Ok, then the JITpipeline solution won't work for us, since we don't want to
    be hitting this event so many times for just a few header vars. I'll go
    back to using the parameters and let the report writers pick up the values
    in RAP.

    Thanks,
    Andy

  • edited June 2003
    You could still use a JIT, just use a line of RAP code to get the value from
    the JIT and stick it in a TppLabel, which doesn't participate in the
    previous noisy notification like Variables and dbTexts do.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.