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

Tracing Source Code Problem

edited August 2006 in General
I'm using Delphi 5 & RB 7.04 Enterprise for this particular project.

I am trying to track down access violations that I'm getting on
Template.LoadFromFile. To do that, I changed my path from RBuilder\Lib to
RBuilder\Source. When it compiles, I get:

raClass compiled with a different version of ppComm.TppCommunicator.

I have tried removing the .pas files for ppRTTI and ppComm and restoring the
versions in the Lib folder, but I still can't get past this error. I don't
want to uninstall and reinstall RB. Can someone tell me which .dcu files to
put in there so that I can still trace through the source code that I do
have and find out why I get access violations?

Incidentally, the access violations happen if I load a report using a JIT
pipeline that prints from a string list, then after that run a report that
uses a DB Pipeline and RAP. The violations happen when the second report is
loaded with LoadFromFile. Sharing any ideas on why this might be happening
would be appreciated.

David Miller

Comments

  • edited August 2006
    Hi David,

    This error indicates that the Interface section of one of your RB source
    files has been changed from its original state. Since we do not ship the
    source to RAP, all the source files must remain interface specific in order
    to compile your project with the .dcu files. One option would be to install
    RB on another computer and compare the newly installed source to your own.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006
    There are a lot of files to compare and I'm not making much progress.

    If I put the library path back to Lib, I can compile without any problems.
    The next time I put source back in, I got the following error:

    Unit raCodMod was compiled with a different version of
    ppTmplat.TppTemplate.SetFileName.

    It is stopping at my RAPFunc unit, which is my unit for passing customized
    variables and functions to RAP. The line it stops on is a uses statement:

    uses
    Forms, raFunc, ppRTTI, vars, dialogs, GFunc;

    It halts specifically at raFunc. I've checked the date of the dcu for this
    file, and it is 6/23/2004, which seems agreeable with the other dcu files.
    I've looked at unit raCodMod too. Same date. Do you have a list of
    ancestor units that I should be looking at? I have not modified any source
    code myself, but I did upgrade RBuilder several times.

    David Miller.


  • edited August 2006
    I was able to get things to work by deleting several report builder database
    plug-ins that were left in my Projects\BPL folder. I don't know why the
    compiler would trip up over that when the only change I was making in the
    path was RBuilder\Lib to Rbuilder\Source, but it is compiling now.

    I was hoping that being able to trace the source would help me figure out
    these access violations, but it didn't help at all. Can you help me with
    that?

    The access violations happen if I load a report using a JIT pipeline that
    prints from a string list, then after that, I run a report that uses a DB
    Pipeline. The violations happen when the second report is loaded with
    Template.LoadFromFile. After the first violation, the second report still
    prints, but if I try it again, I get a whole bunch of nasty violations and
    runtime errors.

    Am I not suppose to mix JIT pipelines with DB pipelines? I didn't have any
    problems until I added the JIT pipeline, and it only happens after I have
    viewed the report that uses the JIT pipeline. I can keep viewing the report
    that uses the JIT pipeline fine, but as soon as I try to view one of the
    other reports that uses the DB pipeline, it wacks out. Conversely, I can
    view the other reports just fine too, but if I take a look at the report
    using the JIT pipeline, after that, I will start getting access violations
    if I try one of the DB reports.

    Any ideas?

    David Miller.

  • edited August 2006
    More information:

    I found a strange workaround. If I set the RecordCount to -1 on the JIT
    pipeline in a Try / Finally loop after I have used it, the errors disappear.
    I suspect that the Report was trying to do something in the LoadFromFile
    with the JIT pipeline's OnGetFieldValue. I was looking for how to turn
    Enabled off but there is not one, so I set RecordCount to -1 and my problems
    went away.

    Is this WAD, or did I just find a strange way of working around something I
    should not be doing?

    I guess my question is whether or not it is considered standard practice to
    mix JIT pipelines with DB pipelines in a report.

    David Miller


  • edited August 2006
    Hi David,

    Mixing JITPipelines and DBPipelines should not be a problem. JITPipelines
    are essentially the same as DBPipelines only they do not contain any
    built-in logic to connect, traverse, locate, etc. your data. This is why in
    a JITPipeline it is up to you to implement the proper events such as
    OnRecordPositionChange and OnGotoBookmark. I'm guessing problems may be
    occuring if you were accessing the same dataset with a DBPipeline and your
    JITPipeline event code at the same time. Setting the RecordCount to -1
    prevents any of the JIT event code from firing and perhaps solved the
    problem.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006
    The JITPipeline was not accessing the same data.

    If I loaded a report that used the JITPipeline, thereafter loading another
    report that did not use the JITPipeline still caused the events in the
    JITPipeline to fire during the process of loading the new report that did
    not use the JITPipeline. Strange. Apparently it left something in the
    report component from the first load that fired while loading the new report
    template. It would be nice to have a method that could cleanup a report
    component to its original state prior to loading a template. I did not want
    to have to generate that JITPipeline data for all the other report templates
    that don't use it, so I'm glad I found that setting the RecordCount to -1 as
    my own cleanup procedure kept the errors from happening on subsequent
    template.loadfromfile commands.

    By the way, I did not implement any OnRecordPositionChange or OnGotoBookMark
    events. I only set two methods: OnGetFieldValue and OnGetDataSetName. I
    was just trying to follow the demo, so if I should set more than this,
    please let me know. I think the OnGetFieldValue is what was causing the
    problem in the LoadFromFile when loading templates where the JITPipeline was
    not being used. Somehow it was firing while loading the new template.

    David Miller.


  • edited August 2006
    Hi David,

    Sorry for the delay, my newsreader lost track of the thread.

    You are correct, all you need to implement to successfully get the
    JITPipeline working is the OnGetFieldValue event technically.

    I will take a look at this. Have you tried disconnecting the JITPipeline
    before loading your Template? Are you connecting your templates to a
    DBPipeline after they are loaded or are you saving them connected to a
    pipeline (or are you using DADE)?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2006
    I tried changing the Report pipeline to something other than the
    JITPipeline. That is the only way I knew to disconnect the pipeline. Is
    there another way? I usually just set visible to true or false depending on
    what pipelines I want to be available.

    Some of my templates have the pipeline saved with them. Some of them have
    no pipeline as the saved value. Most of these are for forms that do not
    traverse data. They use the current record. The JITPipeline is the only
    one that actually traverses data.

    I am not using DADE for these particular forms. I setup everything myself
    in Dephi, opening the tables and positioning the record before loading the
    template and printing the report. The data tab is blank with no data tables
    showing there.

    Remember that I did find a work around by setting the RecordCount to -1
    after I got done, so if you are busy with other things, I wouldn't worry too
    much about this. It did waste a lot of my time trying to figure out what
    was wrong, so it might be nice to fix it in a future update, but for now, I
    have a solution that seems to work.

    If you do look into it, then as best I can tell, the JITPipeline was firing
    when loading a template that did not use the JITPipeline. Of course, it
    would only do this if a template using the JITPipeline was loaded and
    printed prior to trying to load this template that does not use the
    JITPipeline. I hope this is clear. It is a little confusing trying to
    explain it.

    David Miller.


  • edited August 2006
    Hi David,

    Thanks for the info. In my testing with RB 10.04 and Delphi 7, this seemed
    to work correctly. This is something that was perhaps fixed for a release
    later than 7.04. Thanks again.

    --
    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.