How to access variables???

hxghxg
edited January 2009 in FastReport 4.0
After 2 days "playing" around with FR I'm sorry, my patience is over [img]style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif" /> FR seems to be a very powerful tool, but the provided help is to say it softly, inadequate. It's nice we have demos, but the demos don't cover[/img]_BASIC_ things like for example working with variables. It's very nice in the Programmers manual there's an example how to assign the variables, but there's no single sign of how to access them later on [img]style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":o" border="0" alt="ohmy.gif" /> Here comes my problem: I want to print a stupid report with some TfrxShapeViews, one of them is called TypeShape. There's also a TfrxSysMemoView called TypeMemo. I defined a variable called TypeLabel, I fill it up in before I call PrepareReport. When the variable is emtpy (''), I don't want to print the TypeShape. When the variable TypeLabel is not empty, I want to print it's value as well as the shape. Here's is the "OnBeforePrint" code of TypeShape, this is the way I used to do this in QR. However in FR it doesn't work![/img]
procedure rtTypeOnBeforePrint(Sender: TfrxComponent);
begin
if frxGlobalVariables <> '' then
begin
TypeShape.Visible := true;
TypeMemo.Memo.Clear;
TypeMemo.Memo.Add(frxGlobalVariables);
TypeMemo.Visible := true;
end;
end;

What I'm doing wrong?? Or how can I access the variables from the PascalScript in my report?

Please just don't tell me to take a look at the demos - I know them all line by line, I read several times all the Manuals, but no luck... As I wrote above, FR is a great tool, but it's big let down is the lack of appropriate manual >

Comments

  • edited 7:32AM
    hxg wrote: »
    After 2 days "playing" around with FR I'm sorry, my patience is over [img]style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif" /> FR seems to be a very powerful tool, but the provided help is to say it softly, inadequate. It's nice we have demos, but the demos don't cover[/img]_BASIC_ things like for example working with variables. It's very nice in the Programmers manual there's an example how to assign the variables, but there's no single sign of how to access them later on [img]style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":o" border="0" alt="ohmy.gif" /> Here comes my problem: I want to print a stupid report with some TfrxShapeViews, one of them is called TypeShape. There's also a TfrxSysMemoView called TypeMemo. I defined a variable called TypeLabel, I fill it up in before I call PrepareReport. When the variable is emtpy (''), I don't want to print the TypeShape. When the variable TypeLabel is not empty, I want to print it's value as well as the shape. Here's is the "OnBeforePrint" code of TypeShape, this is the way I used to do this in QR. However in FR it doesn't work![/img]
    procedure rtTypeOnBeforePrint(Sender: TfrxComponent);
    begin
    if frxGlobalVariables <> '' then
    begin
    TypeShape.Visible := true;
    TypeMemo.Memo.Clear;
    TypeMemo.Memo.Add(frxGlobalVariables);
    TypeMemo.Visible := true;
    end;
    end;

    What I'm doing wrong?? Or how can I access the variables from the PascalScript in my report?

    Please just don't tell me to take a look at the demos - I know them all line by line, I read several times all the Manuals, but no luck... As I wrote above, FR is a great tool, but it's big let down is the lack of appropriate manual >


    if Get('myvariable') <> '' then... Variable can be set in a similar fashion - Set('myvariable','TempValue');
    Good luck...
  • edited 7:32AM
    hxg wrote: »
    After 2 days "playing" around with FR I'm sorry, my patience is over [img]style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif" /> FR seems to be a very powerful tool, but the provided help is to say it softly, inadequate. It's nice we have demos, but the demos don't cover[/img]_BASIC_ things like for example working with variables. It's very nice in the Programmers manual there's an example how to assign the variables, but there's no single sign of how to access them later on [img]style_emoticons/<#EMO_DIR#>/ohmy.gif" style="vertical-align:middle" emoid=":o" border="0" alt="ohmy.gif" /> Here comes my problem: I want to print a stupid report with some TfrxShapeViews, one of them is called TypeShape. There's also a TfrxSysMemoView called TypeMemo. I defined a variable called TypeLabel, I fill it up in before I call PrepareReport. When the variable is emtpy (''), I don't want to print the TypeShape. When the variable TypeLabel is not empty, I want to print it's value as well as the shape. Here's is the "OnBeforePrint" code of TypeShape, this is the way I used to do this in QR. However in FR it doesn't work![/img]
    procedure rtTypeOnBeforePrint(Sender: TfrxComponent);
    begin
    if frxGlobalVariables <> '' then
    begin
    TypeShape.Visible := true;
    TypeMemo.Memo.Clear;
    TypeMemo.Memo.Add(frxGlobalVariables);
    TypeMemo.Visible := true;
    end;
    end;

    What I'm doing wrong?? Or how can I access the variables from the PascalScript in my report?

    Please just don't tell me to take a look at the demos - I know them all line by line, I read several times all the Manuals, but no luck... As I wrote above, FR is a great tool, but it's big let down is the lack of appropriate manual >

    Hi,

    Here's how I access variable

    Report.variables

    ex: TfrxMemoView(Sender).Memo.Text := Report.variables ;

    Hope it helps

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.