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

Automating the update of Report Templates

edited January 2007 in General
Delphi 6/BDS 2006
ReportBuilder Enterprise 7 or 10


Hello

Our various products store all their standard report templates in a
database and I was wondering if there is any sample code which
demonstrates how I could automate the updating of these templates when
we release a new version of a product. This would involve replacing
existing templates and inserting new ones.

I realise I could just write a database application to delete/insert
the report designs from a database containing the new templates but I
would prefer to load the new/updated templates from a text file which
could hold the alterations for each version. This would enable me to
determine the changes between the versions and so automate the update
to the latest version. I do a similar thing to update the database
schema.

Thanks

Stuart

Comments

  • edited January 2007
    Hi Stuart,

    ReportBuilder does not contain any built-in feature to automatically update
    your templates using a version control style process as you describe below.
    I can see how something like this would be very useful however and we will
    consider something like this for a later relese. Thanks for your feedback.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Thanks for the reply.

    It's certainly a feature I would use.

    For now may be I could extra the template in a text format and included
    it in a XML file.

    Any help you could give on how to extra/update a template in a text
    format would be very much appreciated.

    Keep up the Good Work

    Stuart
  • edited January 2007
    Hi Stuart,

    To save a template as text be sure to set the Report.Template.Format
    property to ftASCII. This will save the template down as a text file
    similar to the format of a .dfm file in Delphi and will make it much easier
    to track small changes in the report.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2007
    Hello Nico

    Thanks for the reply.

    I have been looking at your 'EditTemplatesAsText' demo and it looks
    like I can use this as the basis for updating the existing templates
    via code. i.e. Load a new text based template, convert it to a Binary
    stream and then saving it back to the database.

    I have not had a chance to implement it yet but in theory it should
    work.

    Stuart
  • edited January 2007
    Hi Stuart

    I asked basically the same question in the end-user group.

    I have sucessfully implemented a synchronisation server for our reports. It
    allows updating of existing reports, as well as adding of new reports, all
    automated.

    Some recommendations/suggestions for you from what i did.

    1) you only have to worry about the rb_item, and rb_folder tables (if only
    transferring the template around).
    2) to determine what has changed, i used the modified field in the rb_item
    table. When transmitting it around, its a date field, stored as a '%15.10f'
    float field
    3) when updating an existing template, I had to do it in 2 steps.
    a) Update the template
    b) Update the modified time
    This is because there is a 4 field clustered index on the rb_item table.
    SQL2K atleast doesnt like updating of a BLOB field as well as part of a
    clustered index at the same time.
    I am sure there was a way around this, by putting all of the fields in
    the clustered index in the where clause.
    Inserting a new template could be done in one statement
    4) When Updating the rb_item table, make sure you update the itemsize field
    to be the size of the template, once its back in binary form.

    If i can help any further, let me know.

    Scott


    The 'EditTemplatesAsText' is exactly what you
  • edited January 2007
    Hello Scott

    Thanks for the advice, much appreciated.

    So far I have managed to save the new designs to an XML file (which I
    can provide as part of an update) and successfully updated the
    templates. All I need to do now is to write the app. to build the XML
    file and then come up with a strategy to avoid over writing designs
    which the users have changed themselves may be using the modified field
    as you suggested.

    Thanks again

    Stuart
This discussion has been closed.