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

Resetting AutoSearchFields in RAP

edited August 2005 in RAP
I'm using RB 7.04 and am having some difficulty resetting the auto search
fields. I'm trying to use ideas taken from the demo under 5.AutoSearch /
6.Set End-User Search Criteria in Code.

I have a query on the actual form which pulls a record containing operating
summary figures. That record contains the starting and ending transaction
numbers for another query that I want to do in the report. Some reports
will want the additional detail query of the transactions and some will not,
so I want to do this detail in the Report rather than creating another query
in Delphi. So, I have constructed another query in DADE for use in a
subreport as the last section of the report. I have selected the TransNo
field and set it to autosearch so that SQL was generated like the following:

SELECT * FROM TRANS
WHERE ( Trans.TransNo >= 1 )
AND ( Trans.TransNo <= 99 )
ORDER BY Trans.TransNo

Now I want to stop the autodialog from showing, so in the
BeforeAutoSearchDialogCreate event, I have put:
Report.ShowAutoSearchDialog:=False;

That seems to work fine.

Then in the OnGetSearchValues event, I have put:

if (Report.AutoSearchFields[0].FieldName = 'TransNo') then
Report.AutoSearchFields[0].SearchExpression := '1';
if (Report.AutoSearchFields[1].FieldName = 'TransNo') then
Report.AutoSearchFields[1].SearchExpression := '88';

I'm doing this as a test. I actually want to set it to values found in the
two fields in my other table. However, the test does not work. I'm still
getting records with TransNo > 88. Can anyone give me some direction here?
I have tried using 'Trans.TransNo' as the field name too.

One other question. Something is slowing this report way down. When I
click on the Calc tab, it takes about fifteen seconds before it shows.
Compiling just these few lines takes about 10 seconds. When I preview, it
goes fast, but when I go back to the designer, it takes about 15 seconds.
Any tips on why this is happening?

David Miller.

Comments

  • edited August 2005
    I discovered that the code doesn't work when using the preview tab, but it
    works fine when the report is actually run from the main application. I
    still wonder why the Calc tab takes so long to come up when I click on it.


  • edited August 2005
    Hi David,

    In RB 7.04, the BeforeShowAutoSearchDialog event may not be firing at the
    right time (early enough or at all) to successfully change the AutoSearch
    field. In RB 9.02, some new features and events were added to RAP in order
    to make this process easier. The TdaSQLBuilder object was added to allow
    you to access the SQL object and alter it using a very easy to understand
    set of commands. The BeforeOpenDataPipelines and AfterOpenDataPipelines
    events were added to give you a chance to make these changes even before the
    OnGetAutoSearchValues event fires.

    My suggestion would be to download a trial version of RB 9.02 and test your
    app with that (backing up any RB 7.04 templates and your RB 7.04
    installation file). This may also improve the performance when switching
    from the Preview tab to other tabs.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    Thanks, Nico. I have already purchased a license to version 9.02 Enterprise
    and Server Editions, but I cannot use RB9 yet because I have hundreds of
    reports that use the RBAddOn components which another Digital Metaphors
    person had recommended to me back when I was using RB6 Professional and I
    needed better merge capability. Those components have not been upgraded to
    version 9, so I am kind of stuck right now until I can make time to redesign
    all those reports using RB9. I am not looking forward to that.

    Most normal reports I have are pretty fast. The reports that involve this
    operating summary are not. The operating summary table has almost 300
    fields, and most of these are printing on the report. There also are many
    graphic lines and labels, and about 30 calculated variables that were put in
    when I was using RB6 professional, so they were not done in RAP. I have one
    record spanning two pages using a dynamic height detail band. Are there any
    settings I should consider that might enhance performance in this particular
    situation? I have two tables on the form which are positioned to the
    desired record before invoking RB7, and there are two datapipelines on that
    form as well, hooked up to the tables, with RangeBegin and RangeEnd set to
    rbCurrentRecord and reCurrentRecord respectively. A direct preview of the
    report from the form takes about 15 seconds before the report appears. If I
    go to the designer, it comes up pretty quick, but when I click on the calc
    tab, there I am waiting about 15 seconds until it fills in. If I go to
    preview from there, it is fairly fast, but when I click back on Design, I am
    stuck waiting for awhile before it shows. When I used RB6 Pro, I did not
    have these delays in previewing the report. Of course, I did not have the
    Calc tab either, so I am suspecting the slow down might have to do with
    that. As I said before, there are many calc variables that are used that
    are hooked to code in Delphi rather than RAP because they were made with RB6
    Pro. Could this be part of the reason for the slow down? Would putting all
    the code for those calc variables in RAP instead of my Delphi unit help?

    David Miller.


  • edited August 2005
    Here's another clue for you.

    If I go into the application and simply preview the report on the screen
    without ever going into the designer, the report prints pretty fast.
    However, if I go into the designer first, and don't do anything but exit,
    and then attempt to preview the report on the screen, it takes about 15
    seconds of showing an hour glass before the report shows. Any ideas of why?

    David Miller.


  • edited August 2005
    Hi David,

    Sorry for the delay, somehow my news reader did not pick up your recent
    posts until now.

    Are you loading templates created in RB6? If so, each time you load one the
    report engine needs to parse through the template code and make the proper
    changes in order to successfully run the template in RB7. If after this
    conversion the template is not saved down, RB will be forced to go through
    this process all over again every time the template is loaded.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    The template was originally created in RB6, but I have saved it again after
    loading it in the designer. The template does say Version = '7.04'.

    Also, I have my settings set to save the report templates as ASCII. Should
    I be saving them as binary for faster loading and processing? I was having
    them save as ASCII in case an end user wanted to modify the template in some
    way.

    David Miller.


  • edited August 2005
    Hi David,

    Loading the reports from ASCII format will take a bit more processing but
    should not take 15 seconds.

    If you completely take RAP out of the picture, does everything run as
    expected? Are you using the data tab(DADE) to create you datasets for each
    report template? Does this take a while to load? Also, which
    database/connectivity are you using? Are you accessing data over a network?

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2005
    I'm not sure what you mean by taking RAP COMPLETELY out of the picture. I
    have another report that uses the same pipelines, but does not have any RAP
    calculations at all. It is a shorter report. It does have many calc
    variables, but they do not use RAP. It does not use the DADE either. When
    I first loaded it and clicked on the CALC tab, it would take 41 seconds for
    the CALC tab to show up. I tested this several times to make sure it was
    not a fluke. I realized that this template had been saved under RB6, so I
    resaved it under RB7.04, exited the program, then went back into it and
    loaded the designer. I also closed some other programs I had open like
    Acrobat. Now it will only take 11 seconds when I click on the CALC tab. If
    I never go into the designer at all, previewing the report is fast, almost
    instantaneous. However, if I go into the designer first, then exit the
    designer without doing anything, then preview the report, it will pause for
    11 seconds before the report shows. If I preview again, same thing. If I
    exit the program, then go back in and preview, it is fast again. The delay
    of 11 seconds here is basically the same delay I see if I click on the CALC
    tab in the designer. It seems like it must have something to do with memory
    allocation and deallocation, but I'm just giving a wild guess. Maybe it has
    something to do with all the calc variables that were created under RB6 Pro
    and therefore did not use RAP.

    My database connectivity is Flash Filer 2.12. I am not accessing data over
    the network. It is on a local hard drive. Also, the data is not being
    retrieved by DADE. I have two tables that are positioned before calling
    Report Builder, and two data pipelines are connected to these tables. There
    is no data traversal as the report simply prints from a single record in the
    two data files.

    David Miller.


  • edited August 2005
    Hi David,

    Unfortunately we have not seen this behavior before in ReportBuilder. Have
    you tried to run a similar test in RB 9.02? If not, you may want to try
    this and see if it makes a difference. If this is a bug of some sort, then
    we would only be able to address it in the latest version of ReportBuilder
    (9.02). I would also recommend trying to use the demo provided with
    ReportBuilder and see if you can still get the same behavior.

    If at all possible, please put together a small example I can run on my
    machine and send it to support@digital-metaphors.com in .zip format so I can
    try to get to the bottom of this for you.

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