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

Using Report Explorer and Loading From File

edited November 2003 in End User
Greetings,

I would like to use the ppReportExplorer but load the template from a file
rather than from the RB_ITEM.TEMPLATE field.

Does anyone have an example of how I could do this? Is there already a demo
on how to do this? Any tips appeciated. I'm just a little lost on how to
do this.

--
Michael Tuttle
Software Technologies, Inc.
Topeka, KS

Comments

  • edited November 2003

    The ReportExplorer is designed to work with DataPipelines. Therefore the
    approach to this solution would be use JITPipelines. However, the
    JITPipeline does not currently implement the GetFieldAsStream method that is
    used to access the report template data. You would need to create a
    JITPipeline descendant and add this support.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Greetings Nard,

    My component developing skills are somewhat limited. Any chance I could get
    your help creating this descendant and adding this GetFieldAsStream method
    you talk about. If you could do this I could test it. If not, if you could
    provide a little more assistance on how to do this it would be much
    appreciated.

    Thanks,

    Mike

  • edited November 2003

    Below is some sample code (I did not compile or test it) that creates a
    descendant of TmyJITPipeline and overrides the GetFieldAsStream method
    declared in the ancestor. The method fires a new OnGetFieldAsStream event.
    This enables an event-handler to be implemented that could load the .rtm
    file into a TFileStream and copy it to the aStream parameter passed to the
    event.


    uses
    ppDB, ppDBJIT, ppTypes;


    type

    TppGetFieldAsStreamEvent = procedure (aFieldName: String; aStream:
    TStream) of object;


    TmyJITPipeline = class(TppJITPipeline)
    private
    FOnGetFieldAsStream: TppGetFieldAsStreamEvent ;
    public
    procedure GetFieldAsStream(aFieldName: String; aStream: TStream);
    override;

    property OnGetFieldAsSteam: TppGetFieldAsStreamEvent read
    FOnGetFieldAsStream write FOnGetFieldAsStream;
    end;


    {---------------------------------------------------------------------------
    ---}
    { TmyJITPipeline .GetFieldAsStream }

    procedure TmyJITPipeline.GetFieldAsStream(aFieldName: String; aStream:
    TStream);
    begin
    if Assigned(FOnGetFieldAsStream) then FOnGetFieldAsStream(aFieldName,
    aStream);

    end;







    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Greetings Nard,

    Ok, I created the descendant per your instruction, however I have not used a
    JitPipeLine before or the descendant we created for that matter. When I now
    drop the descendant on the ReportExplorer form I'm guessing I need to
    replace the TppPipeline component for the RB_ITEM table? But I do not see a
    datasource on the TmyJitPipeline descendant. I must be missing something or
    must be dense. How will using a JitPipeline component help me to achieve
    loading a report template form a file instead of from a database as it does
    now. Again, I want to use the ReportExplorer interface but load form a file
    instead of the RB_ITEM.TEMPLATE field. What am I missing here?

    Thanks

    Mike
  • edited November 2003

    I may hvae misunderstood your original question. I thought that you did not
    want to use the rbItems and rbFolders tables at all. Sounds more like, you
    want to use them, but store the reports to .rtm files?

    If the above is the case, then another approach might be to create a
    calculated field for the TDataSet and using the DataSet.OnCalcFields event
    to load the data.You could use the BeforePost or AfterPost event to save the
    Report.Template to a file.

    The JITPipeline is entirely event-handler based. It is really designed for
    read-only access to in-memory data-structures such as an Array or List of
    objects, etc. Sorry, but after thinking about further, I do not think the
    JITPipeline is appropriate. In addition to the GetfieldAsStream it does not
    contain events for saving/updating information.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Greetings Nard,
    not
    the

    Yes, I do want to use the rbFolders and rbItems table. But instead of
    storing the report template to the TEMPLATE field of the RB_ITEM table, I
    was going to add a report template name field a(REPORT_TEMPLATE_FILENAME) to
    this table and then simply instruct the internal report component to load
    the report template from the report template named in that field.

    My question is, how do I instruct the report explorer to NOT load from and
    save to the TEMPLATE field, but instead load a template from a file when
    using the report explorer. I know how to do it with the ppReport component
    outside of this report explorer. Is there some internal way to load this
    report template? I hope I'm making myself clear in that I'm asking how to
    load an external report template into the internal report component of your
    report explorer.

    Thanks

    Mike
  • edited November 2003
    Try creating a custom report explorer form. See
    RBuilder\Tutorials\Complete\Applications.


    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.