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

How did I do that?

edited February 2017 in End User
Hi Team,

I pulled up an old report from 2002. Yes it still works.

In the Header there is a Memo with some text, including dates passed to the report.

When I preview the report the text is changed:

From this..
"Show all data where the Date Repaired is on or before 15/04/2007
and the Date Repaired is on or after 01/04/2007"

To this..
"Show all data where the Date Repaired is between 01/04/2007 & 15/04/2007."


Damned if I can find where/how I did that!

Some guidance/pointer if you would?

Regards & TIA,
Ian

Comments

  • edited February 2017
    Hi Ian,

    The first scenario is likely using separate "<=" and ">=" search
    conditions separated by an AND keyword...

    WHERE
    Date_Repaired <= 15/04/2007
    AND
    Date_Repaired >= 01/04/2007

    The second scenario simply uses the BETWEEN search condition

    WHERE
    Date_Repaired BETWEEN 01/04/2007 AND 15/04/2007


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2017
    Hi Nico,
    Thank you for the reply.
    Perhaps I wasn't clear enough.
    I am referring to the text in the memo changing from the first in Design to the second in Preview.
    This is while in the Report Builder.
    Regards,
    Ian
  • edited February 2017
    I found that if I select Report|Page Style I can see the Preview text in the memo.
  • edited February 2017
    Hi Nico,

    Interesting. After I opened and closed the Page Style the memo is showing the 'after' text. Weird.

    OK, so I have what I need showing. I am passing the search dates from the App as 'dd/mm/yyyy,dd/mm/yyyy'. Working
    fine.

    How can I now extract those two dates so I can put them into this string?
    "Showing all Jobs where the Date In is between dd/mm/yyyy and dd/mm/yyyy"

    I thought a Variable but can't see where/how to pick up the Dates as passed to the report.

    Regards & TIA,
    Ian


  • edited February 2017
    Gets deeper. I deleted the Memo and now I get a 'Could not compile program: ReportOnStartPage.'.
    This suggests to me thatthere is something happening in the background I know not where.
  • edited February 2017
    From the .dfm file..

    object raCodeModule1: TraCodeModule
    object raProgramInfo1: TraProgramInfo
    raClassName = 'TraEventHandler'
    raProgram.ProgramName = 'ReportOnStartPage'
    raProgram.ProgramType = ttProcedure
    raProgram.Source =
    'procedure ReportOnStartPage;'#13#10'begin'#13#10' Report.GetAutoSearchDescr' +
    'iptionLines(Memo2.Lines);'#13#10'end;'#13#10
    raProgram.ComponentName = 'Report'
    raProgram.EventName = 'OnStartPage'
    raProgram.EventID = 21
    raProgram.CaretPos = (
    0
    0)
    end
    end

    This would be an indicator but how do I get at this to change it?
  • edited February 2017
    Hi Ian,

    If a memo inside the report is showing this, then you are likely
    populating the memo somewhere in code with the AutoSearch Description.

    According to your .dfm segment, this is in the OnStartPage event of the
    report. Check your RAP code for where this is being done.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2017
    Hi Nico,
    You were 100% correct. I had totally forgotten about being able to access the Events.
    Sure enough, under ReportOnStartPage was:

    {code}
    procedure ReportOnStartPage;
    begin
    Report.GetAutoSearchDescriptionLines(Memo2.Lines);
    end;
    {code}

    So that explains how it is doing what it is doing. Thank you.

    It doesn't explain wherew the text is coming from.
    It isn't being set in the App so it has to be in the Report.

    Anyway, I deleted the event and put the text I was after into the Header.

    So, now, all I need to be able to do is isolate the DateExpression being passed into the report so I can separate the
    two dates. I suppose I could pass them as two more SearchFields but that seems messy.

    Regards & thanks again,
    Ian
This discussion has been closed.