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

draw a line in Detail Band dynamically?

edited December 2004 in General
hi all
I have some records like this
1 200402 NULL
2 200402 2004-02-29 00:00:00.000
2 200402 2004-02-29 00:00:00.000
3 200402 NULL
4 200402 NULL
1 200403 NULL
2 200403 2004-03-03 00:00:00.000
2 200403 2004-03-19 00:00:00.000
2 200403 2004-03-02 00:00:00.000
3 200403 NULL
4 200403 NULL

The value 2 of first field occurs many times
I want a line to separate from value 2 and 3
Look like this
1 200402 NULL
2 200402 2004-02-29 00:00:00.000
2 200402 2004-02-29 00:00:00.000
-----------------------------------------------
3 200402 NULL
4 200402 NULL

1 200403 NULL
2 200403 2004-03-03 00:00:00.000
2 200403 2004-03-19 00:00:00.000
2 200403 2004-03-02 00:00:00.000
-----------------------------------------------
3 200403 NULL
4 200403 NULL

I put all the ppDBText in the Detail Band.
How can I draw the separated line dynamically and
put the following ppDBText in the right position?

Comments

  • edited December 2004

    Try the following:

    1. Add a TppVariable to the report.

    2. Create a Group on the TppVariable.

    3. Add a Line to the GroupFooter

    4. In the Variable.OnGetText event code

    if myDataPipeline['FieldName'] = 2 then
    Text := 2
    else
    Text := 1;


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2004
    Thanks Nard
    Your method works well.
    But the question I asked before is a smiplified version.
    I have 2 "date field|"groups (not including your "custom field ppvariable"
    group)
    When I add your method to my original code,
    the result looks like this
    (productno is first group, yearmonth is second group, ppvariable is third
    group)
    productname1
    1 200402 NULL
    2 200402 2004-02-29 00:00:00.000
    2 200402 2004-02-29 00:00:00.000
    -----------------------------------------------
    3 200402 NULL
    4 200402 NULL
    -----------------------------------------------
    productname2
    1 200403 NULL
    2 200403 2004-03-03 00:00:00.000
    2 200403 2004-03-19 00:00:00.000
    2 200403 2004-03-02 00:00:00.000
    -----------------------------------------------
    3 200403 NULL
    4 200403 NULL
    -----------------------------------------------

    I make the GetText event different yours.

    procedure TfmIN33r.ppVariable1GetText(Sender: TObject; var Text: String);
    begin
    inherited;
    if(cds.fieldbyname('AORDER').AsInteger = 3)then begin
    inc(Fctrl);
    end;
    Text:= IntToStr(Fctrl);
    end;

    When the ReportBuilder judgle the group changed?
    Befor or after the ppVariable GetText event?
  • edited December 2004

    You cannot use the OnGetText event to increment a variable. The OnGetText
    event fires too frequently.

    You also cannot use the OnCalc event of a Variable to control a group,
    because the timing is too late.

    For a Group you need to either use a DataField or use the Variable OnGetText
    event to return a simple value. Or you can use the Group.OnGetBreakValue
    event.




    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.