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

Some more Newbie questions

edited May 2002 in General
Hi.

I am slowly getting the hang of report builder (I think).

A few questions:

1. You can set up a master detail relationship between the
datasources/datasets and between the pipelines. Does it make much
difference, ie, is it better to set the m-d relation in the data components,
the pipeline components, or in both?

2. I have a header band where I have put a logo and patient data. For each
patient, the detail band goes through various visits and puts data for each
visit. The patient data however goes into the header band on each page. Is
there a way I can turn off the patient data component of the header for
subsequent pages but still keep the logo on the header for the subsequent
pages?

3. Scripting in the page . . . Say I have a place on the form where I have a
label and a data field. The data is actually a number (0 or 1) and depending
on its value I want to write "confirmed" or "unconfirmed". In some instances
I don't want anything at all there (say there was a third value 2, and when
it's 2 I want to leave out both the label and the data field and move
everything else up accordingly). How do I set all this up? Is there a way to
visually script this, or does it have to be coded in some way? If so, how?
ie, I want to create the form differently depending on the data (like Cold
Fusion or ASP web programming).

4. In preview mode for a report, there are four buttons for the screen size.
It defaults to the one on the left. How do I get it to default to the one on
the send left?

Thanks!

Lauchlan M.

Comments

  • edited May 2002
    1. Use one or the other but no both. In general there isn't a huge advantage
    to using one or the other. There is a significant advantage if you perform
    pipeline linking in DADE however. Linking on the datasets creates a
    relationship which fires a detail query for every master record by filling
    in search parameters from the master record. DADE creates this relationship
    by submitting a single query to gather all the detail data at once
    eliminating the need for multiple detail query submissions.

    2. Create a group on the patient. Place the patient data in the group header
    and the logo in the actual header. Uncheck 'Reprint Group Headers On
    Subsequent Pages' in the group setup dialog. In more general cases you can
    toggle visibility of components in event handlers using their Visibility
    boolean property.

    3. If you have RB Enterprise you can do this in RAP. Otherwise you can
    create Delphi event handlers. The event handler would look something like
    this:

    case Report.DataPipeline['MyField'] of
    1: Label1.Caption := 'Confirmed';
    2: Label2.Caption := 'Unconfirmed';
    3: Label3.Caption := '';
    end;

    Report.DetailBand.Visibility := not(SameText(Label3.Caption, ''));

    4. See 'Controlling the Built-in Previewer' in TechTips=> General.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    Thanks Alexander.

    With (3), I have RAP . . . how do I use RAP for this?

    Thanks,

    Lauchlan M.
  • edited May 2002
    > 4. See 'Controlling the Built-in Previewer' in TechTips=> General.

    The tip is:

    "You can control the built-in preview form via the
    Report.OnPreviewFormCreate event.

    For example the following code sets the Print Preview form to
    maximized and sets the Viewer ZoomSetting to 100%:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
    begin


    ppReport1.PreviewForm.WindowState := wsMaximized;
    TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting := zs100Percent;


    end;"

    I don't have a viewer on my page, intead I start printing the form and get a
    default preview viewer that comes up. I want to make this the 93% size
    setting. What I need is something like

    ppReport1.PreviewForm.ZoomSetting := zs100Percent;

    But there doesn't seem to be this ZoomSetting for the previewform, only for
    the viewer object. How do I do this for previews when printing?

    I was also expecting there would be some sort of 'edit preferences' globally
    for Report Builder where I could set this kind of preference as a default,
    but there does not seem to be.

    TIA,

    Lauchlan M.
  • edited May 2002
    The following (along the lines of an example in your online help):

    procedure TForm1.report_PatientHistoryPreviewFormCreate(Sender: TObject);
    begin
    report_PatientHistory.PreviewForm.WindowState := wsMaximized;
    (report_PatientHistory.PreviewForm.Viewer).ZoomSetting := zs100Percent;
    end;

    gives me 'undeclared identifier zoomsetting'.

    Lauchlan M.
  • edited May 2002
    You would use RAP in a similar way to implementing the event in Delphi. Go
    over to the Calc tab, select the Detail band object in the Report Objects
    window, then select the BeforePrint event and implement the same code as
    below. You can then access the Code ToolBox window to get at the data in the
    pipeline, the label, and other objects in your report. See the RAP tutorials
    in RBuilder\Demos\RAP for a better introduction on how to use the
    environment.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited May 2002
    The PreviewForm does not actually render the page, the Viewer object does.
    The Viewer object in turn resides on the PreviewForm. When the report goes
    to print to screen it creates the preview form and fires the
    PreviewFormCreate event. At that point you can control how the settings of
    the viewer as shown in the tech tip.

    No, there aren't global settings for things like default zoom settings. You
    can create custom components, i.e. a custom preview form which takes on your
    defaults as one option.

    Also, you are missing the TppViewer cast in the second line. The Viewer is
    returned as a TObject. The line should be :

    TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting := zs100Percent;

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.