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

Help with very simple JITPipeline

edited January 2014 in General
First time trying to use a JITPipeline. In my application I'd like to
dynamically fill a TStringGrid in code with up to 12 rows and 3 columns
of string data. The number of runtime rows and columns could be less,
but never more. The report will, of course, be based on whatever values
wind up being plugged into the StringGrid at runtime as a result of user
input. I've looked at some of the demo and tutorial code for using the
JITPipeline, but it all seems rather complicated for what I believe is a
very simple operation in this case. Are there any other code examples
somewhere that might describe the minimum coding requirements to
retrieve the values from the StringGrid?

Thanks very much for any help!

Comments

  • edited January 2014
    At the very least you will need to create three unique pipeline fields
    (assuming each column in your string grid represents a field), and
    implement the OnGetFieldValue event of the JITPipeline.

    Connect the report to the JITPipeline and place data-aware components
    inside the detail band (TppDBText). Assign the field name for each
    DBText as you normally would with a DBPipeline.

    When the report executes, the OnGetFieldValue event of the JITPipeline
    will fire for each DBText (per traversal) and it is then up to you to
    implement this event to return the correct value based on the field
    parameter.

    You can set the JITPipeline.RecordCount to control traversal (i.e.
    number of times the detail band prints).

    Example:

    function TForm1.ppJITPipeline1GetFieldValue(aFieldName: string): Variant;
    begin

    if aFieldName = 'ID' then
    Result := FStringGrid.Cells[0, ppJITPipeline1.RecordIndex];

    if aFieldName = 'FirstName' then
    Result := FStringGrid.Cells[1, ppJITPipeline1.RecordIndex];

    if aFieldName = 'LastName' then
    Result := FStringGrid.Cells[2, ppJITPipeline1.RecordIndex];

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2014
    Thanks very much, Nico, that's exactly what I was looking for. Much
    appreciated!

This discussion has been closed.