Idea about how to fill rows

Hi guys
;)
I was given a design, which i must respect.
Take a look at this picture
http://www.alipogroup.com/uploads/sshot_report.jpg

I thought a solution, but i think maybe some1 has a better solution.

I put 7 (col) * 9 (row) variables in the report.

Let's suppose. If client buys only 3 things, i check that and make a for ...
then, i set ='' the rest of variables ... so it seems clean ;)

Remember: Actually not implemented, just an idea

Does any1 have a better one ?

PS: I READ DATA FROM A STRINGGRID ;)

Thanks a lot in advance.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:35AM
    the fixed data column titles can be in a page header or column header
    the row mdband set to a record count, the memos within the mdband can be sized to suit. and left empty, no variables what is important is the line#of the band. it must correspond to the string grid row #,here is a sample from fr3
    you should be able to adapt to 2.5

    code in report set tag of memos in md band
    set the tag prop of the bands memos

    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    var
    i: Integer;
    c: TObject;
    begin
    for i := 0 to Sender.Objects.Count - 1 do
    begin
    c := Sender.Objects;
    if c is TfrxMemoView then
    TfrxMemoView©.tag :=<Line>;
    end;
    end;

    code to load report and set row count of mnband in report
    and connect on before print event.
    rep is a global var of tfrxreport.

    procedure TForm1.Button2Click(Sender: TObject);
    var
    bnd:tfrxcomponent;
    begin
    rep.OnBeforePrint := repbeforeprint;
    rep.LoadFromFile('amort.fr3');
    bnd:= rep.FindObject('MasterData1');
    tfrxmasterdata(bnd).RowCount := stringgrid1.rowcount;
    rep.ShowReport;
    end;

    code to fill memos in report memo14 is in the column header the rest are in the mdband

    procedure TForm1.repBeforePrint(Sender: TfrxReportComponent);
    var
    rn:integer;
    st:string;
    begin
    if sender.Name = 'Memo14' then
    begin
    tfrxmemoview(sender).Text:= 'Amortization for '+(stringgrid1.Cells[1,0])+' at '+edit3.Text+' % for '+edit2.text+ ' Years';
    end;

    if sender.Name = 'Memo2' then
    begin
    rn:= sender.Tag;//retrieve int val from tag
    dec(rn,1); // if no fixed row in sgrid dec value by 1
    // retrieve string from the grid
    // the columnnumber is fixed 0 for first if no fixed column in sgrid
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[0,rn]);
    end;
    // repeat for each memo in the row;
    if sender.Name = 'Memo3' then
    begin
    rn:= sender.Tag;
    dec(rn,1);
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[1,rn]);
    end;
    if sender.Name = 'Memo4' then
    begin
    rn:= sender.Tag;
    dec(rn,1);
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[2,rn]);
    end;
    if sender.Name = 'Memo5' then
    begin
    rn:= sender.Tag;
    dec(rn,1);
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[3,rn]);
    end;
    if sender.Name = 'Memo6' then
    begin
    rn:= sender.Tag;
    dec(rn,1);
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[4,rn]);
    end;
    if sender.Name = 'Memo7' then
    begin
    rn:= sender.Tag;
    dec(rn,1);
    tfrxmemoview(sender).Text:= (stringgrid1.Cells[5,rn]);
    end;

    end;

    ;)

  • edited 5:35AM
    thanks a lot gordk !!!
    will see the code, and i'm sure it will work !!
    cya m8 !
  • edited 5:35AM
    it worked perfect
    great solution for reporting stringgrids !!

    thanks again gordk !

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.