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

Richtext

edited January 2010 in General
We are using Delphi 2009 and RB 11.06.

If we add a richtext to a report and mark it as mailmerge and link a field
to the richtext component when running the report or previewing it we get
the field name associated with it (minus the first letter) instead of the
data from the field.

Comments

  • edited January 2010
    Hi Simon,

    I'm a bit unclear what you mean by "link a field to the RichText component".
    Are you using a TppDBRichText component or TppRichText? If you wish to use
    the mailmerge feature, you will need to use the TppRichText component and
    take advantage of the mailmerge side bar in the RTF editor. This makes it
    very easy to add fields to the richtext control. Simply add a TppRichText
    component to your report, right click and select edit.

    In my quick testing this functions correctly.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    We are using the TppRichText clicking edit and using the mail merge side bar
    to add a field but in preview it shows the field name munus the first letter
    instead of the data eg
    the following displays otes instead of the data
    Notes



  • edited January 2010
    Hi Simon,

    If possible, please send a simple example demonstrating this issue (perhaps
    using the DBDEMOS database) that I can run on my machine to
    support@digital-metaphors.com in .zip format and I'll take a look at it for
    you.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    I dont have the DBDEMOS data.

    I created a new project (Delphi 2009) with just a adoconnection, datasource
    and adoquery (SQL 2005 server) using ADO

    Added a pipeline and report. Table in SQL does not matter. Add a richtext
    and edit and add mail mege field. Preview the report and you get the field
    name minus the first letter. I ensured connection and dataset were active.



  • edited January 2010
    Hi Simon,

    If you have Delphi, you have the DBDEMOS database :). It is the data used
    in all our demos.

    I did a quick test using D2009, SQL Server and the example Northwind
    database and everything worked as expected. If you would like, I can send
    you my test example.

    You can send me an example using SQL server. I have SQL Server here that I
    can test with however I will need some data to run your report(s).

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    I have done some more testing using a basic app and Excel as the data source
    and it appears to work whne running the report.

    I noticed that the field attached to the richtext control weas prefixed with
    the pipeline.

    We use sql views to drive the reports and I noticed that the field has no
    prefix for the source of the data, is this the issue ?



  • edited February 2010
    Hi Nick

    Done a bit more testing and it appears fine if just do a basic report
    linking to SQL Server.

    The Only Difference I can is that the pipeline as prefixing the field when
    I create a report using Delphi at design time.

    However when I run the designer at run time is does not prefix the field see
    below.

    From Delphi at design time we get
    NAME

    When we run the designer form our app we get

    NAME


  • edited February 2010
    Hi Simon,

    The pipeline attribute in the merge text instruction is to access pipelines
    not connected to the report. If this is left empty, ReportBuilder will
    automatically use the pipeline connected to the report
    (Report.Datapipeline). Take a look at the TppRichText.MergeText topic in
    the ReportBuilder help for more information on how this feature works. The
    easiest way is to use the Merge Text side bar of the RTF editor to define
    which pipeline you would like to use for the field selected.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    Thanks for your help, I have got to the bottom of the problem not sure if it
    is a bug or not

    If use the add field button to add the field to the richtext then it formats
    it like this Code and this does not work, if I change it to
    then it works. This is in run time design mode form our app. Not sure why it is formating it with the dbtext at the beginning and end of the field name?
  • edited February 2010
    Hi Simon,

    Thanks for the info. The "" syntax is for backward compatibility. "Code" is the new syntax and should perform the same task. So far, using the new syntax, I am unable to recreate the behavior you are getting. If this is a bug, the only way I'm going to track it down is by seeing it in action. If you can recreate this with a simple application, please send it to support@digital-metaphors.com and I'll take a look at it. -- Regards, Nico Cizik Digital Metaphors http://www.digital-metaphors.com
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2010
    I am using ver 11.06 does this make any difference ?
  • edited February 2010
    I have been looking at this in more detail and do not understand wht the old
    worked but the new FieldName does not work.

    When we create a report at runtime we use dummy views for the user to select
    from eg ZZ_MYVIEW (this has no data in it) but when we run the actual report
    we change the view name to the correct view eg AA_MYVIEW. Will changing the
    view name at report runtime cause this issue?


  • edited February 2010
    Hi Simon,

    This could have an effect depending on when you are changing the name of the
    View. Basically ReportBuilder retrieves data from a connected dataset
    as-is. If the timing at which that data becomes available does not coincide
    with when it needs to be retrieved, problems can occur.

    If you would like, you can trace into the RB source where all of this is
    being processed. Perhaps it will give you some clues on why one method is
    working and the other is not.

    Try setting a break point inside the TppCustomRichText.MergeDBFields routine
    in the ppRichTx.pas file (This file will need to be in your Delphi library
    path). The MergeDBFields routine is kept for backward compatibility. The
    MergeTaggedDBFields routine attempts to merge with the new syntax.

    My guess is the problem is near the top where the MergeDBFields routine
    checks if the pipeline is nil.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2010
    We have debugged this issue it is failing on the following code from
    pprichtx.pass

    lDataPipeline := Band.Report.DataPipeline;

    if (lDataPipeline = nil) then

    begin

    MergeTaggedDBFields;

    Exit;

    end;



    Our Datapipeline is not nil so the code is not firing



    Any Ideas

  • edited April 2010
    Hi Simon,


    This is true however you will see at the bottom of the routine that
    MergeTaggedDBFields is eventually called whether the pipeline in nil or not.

    Are you by chance using InfoPower? We recently had a similar issue with a
    customer using InfoPower that we were able to recreate and solve.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2010
    Hi Nico,

    I'm replying on Simon's behalf. Yes we are using infopower.
    Interestingly, the old method for marking a merge field still works.

    Thanks,

    Steve Branley

  • edited April 2010
    Hi Stephen,


    Thanks for the information. For future reference, it is very helpful if you
    let us know which components you are using prior to asking a question
    (especially the components that directly relate to ReportBuilder and the
    issue you are having). :)

    There is a patch to the InfoPower plugin available that fixes this issue. I
    sent the patch to your email address however if anyone else would like the
    patch, please contact support@digital-metaphors.com.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.