W
W
White_Bambie2019-03-16 12:40:15
Delphi
White_Bambie, 2019-03-16 12:40:15

How to display rows in a cycle in a FastReport report?

Faced such a problem. It is necessary to display in the fields (Memo156 - MemoN) of the report (FastReport) lines from the Memo3 form of the program. But not the lines themselves are displayed, but their total number.
I don’t understand cycles well and wrote some nonsense.
Correct, please, to whom it is not difficult.

procedure TfDM.EST1Click(Sender: TObject);
var
  i: Integer;
  T: TfrxMemoView;
begin
  for i:=0 to fMain.Memo3.Lines.Count - 1 do
    begin
      T:= TfrxMemoView(frxAIR1.FindObject('Memo156'));
      T.Memo.Text := fMain.Memo3.Lines.Strings[i];
      T:= TfrxMemoView(frxAIR1.FindObject('Memo157'));
      T.Memo.Text := fMain.Memo3.Lines.Strings[i];
      T:= TfrxMemoView(frxAIR1.FindObject('Memo158'));
      T.Memo.Text := fMain.Memo3.Lines.Strings[i];
// и так далее...
    end;
    frxAIR1.ShowReport;
end;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stockholm Syndrome, 2019-03-16
@White_Bambie

maybe not fMain.Memo3.Lines.Strings[P], right fMain.Memo3.Lines.Strings[I]?
in fact, I didn’t really understand the task, since I’m not familiar with FastReport, but probably so

const 
  START_INDEX = 156;
var
  I: Integer;
  T: TfrxMemoView;
begin
  for I := 0 to fMain.Memo3.Lines.Count - 1 do begin
    T := TfrxMemoView(frxAIR1.FindObject('Memo' + (START_INDEX + I).ToString()));
    T.Memo.Text := fMain.Memo3.Lines[I];
  end;
  frxAIR1.ShowReport();
end;

K
Konstantin Tsvetkov, 2019-03-16
@tsklab

iYou rewrite every cycle T.Memo.Text.
Or:

procedure TfDM.EST1Click(Sender: TObject);
var
  i: Integer;
  T: TfrxMemoView;
begin
      T:= TfrxMemoView(frxAIR1.FindObject('Memo156'));
      T.Memo.Text := fMain.Memo3.Text;
      T:= TfrxMemoView(frxAIR1.FindObject('Memo157'));
      T.Memo.Text := fMain.Memo3.Text;
      T:= TfrxMemoView(frxAIR1.FindObject('Memo158'));
      T.Memo.Text := fMain.Memo3.Text;
// и так далее...
    frxAIR1.ShowReport;
end;

Or:
procedure TfDM.EST1Click(Sender: TObject);
var
  i: Integer;
  T: TfrxMemoView;
begin
  for i:=0 to fMain.Memo3.Lines.Count - 1 do
    begin
      T:= TfrxMemoView(frxAIR1.FindObject('Memo156'));
      T.Memo.Lines.Add( fMain.Memo3.Lines[i]);
      T:= TfrxMemoView(frxAIR1.FindObject('Memo157'));
      T.Memo.Lines.Add( fMain.Memo3.Lines[i]);
      T:= TfrxMemoView(frxAIR1.FindObject('Memo158'));
      T.Memo.Lines.Add( fMain.Memo3.Lines[i]);
// и так далее...
    end;
    frxAIR1.ShowReport;
end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question