How to access variables???
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="" 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
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
if Get('myvariable') <> '' then... Variable can be set in a similar fashion - Set('myvariable','TempValue');
Good luck...
Hi,
Here's how I access variable
Report.variables
ex: TfrxMemoView(Sender).Memo.Text := Report.variables ;
Hope it helps