Creating a Calendar

edited 12:08AM in FastReport 3.0
Hi...

I'm a little confused about how to create a year calendar using FR3?!?!

The layout should be like this (for one month):

January
-----------
MO |            | 03 GRP3  | 10         |            |            |
TU |            | 04 GRP4  | 11         |            |            |
WE |            | 05 GRP1  |            |            |            |
TH |            | 06 GRP2  |            |            |            |
FR |            | 07 GRP3  |            |            |            |
SA | 01  GRP1   | 08       |            |            |            |
SU | 02  GRP2   | 09       |            |            | 31 GRPx    |

The months 'February' to 'December' should be layouted exact the same except, the first day of month differs.

First, I thought about using cross-tabs, but I didn't foudn any possibilities to change it's position and how to include more than one instance.

Did I need to completly draw the report by myself??

Please help...

Comments

  • edited 12:08AM
    I post the calendar report to the newsgroups, fast-reports.public.binaries group. Open it in the demos\main demo.
  • edited 12:08AM
    ...Thx...but how do I fill the cells with custom data???

    Nearly all 365 cells should contain custom data accessable via the core application.

    This is the event from the calendar demo:

    procedure Memo1OnBeforePrint(Sender: TfrxComponent);
    var
    CellNo, RealDay: Integer;
    begin
    CellNo := DayLine + (<Line> - 1) * 7;
    RealDay := CellNo - StartDay + 1;
    if (CellNo < StartDay) or (RealDay > LastDay) then
    Day := ''
    else
    begin
    Day := Format('%.2d', [RealDay]);
    end;
    end;

    How can I include custom data to this event?? I thought about using variables with unique generated names:

    DayVar := Format('%.2d%.2d', [0 + Month, 0 + RealDay]);

    ...and include this variable to:

    Day := Format('%.2d %s', [RealDay, <DayVar>]);

    but this doesn't work. Any other idea????
  • edited 12:08AM
    Okay...I found a solution:
        DayVar := Format('%.2d%.2d', [0 + Month, 0 + RealDay]);
        try
          Dummy := Get(DayVar);
        except
          Dummy := '';
        end;
        Day := Format('%.2d %s', [RealDay, Dummy]);
    

    But the try/except doesn't seems to work - I don't get an error while building the report but if finished, I get an exception overview with all unknown variables!

    How to disable this summary?
  • edited 12:08AM
    You can't create new variables in code, like it was in FR2.x. DayVar should be declared.

Leave a Comment