Using variables as strings
Hi,
I have defined a variable in a report called 'reporting_currency'. I am setting this variable in Delphi code before opening the report, like so:
if frxReport1.Variables.Items.Name = 'reporting_currency' then
begin
frxReport1.Variables.Items.Value := 'USD';
end;
Now, when I want to use the value of the variable to set a label in the report:
colHdr.Memo.Text := 'Currency ' + <reporting_currency>
I get the error:
Undeclared identifier 'USD'
I have defined a variable in a report called 'reporting_currency'. I am setting this variable in Delphi code before opening the report, like so:
if frxReport1.Variables.Items.Name = 'reporting_currency' then
begin
frxReport1.Variables.Items.Value := 'USD';
end;
Now, when I want to use the value of the variable to set a label in the report:
colHdr.Memo.Text := 'Currency ' + <reporting_currency>
I get the error:
Undeclared identifier 'USD'
Comments
Found the solution, it was:
if frxReport1.Variables.Items.Name = 'reporting_currency' then
begin
frxReport1.Variables.Items.Value := '''' + 'USD' + '''';
end;
I mean
frxReport1.Variables.Items.Value := '''USD''';
or
frxReport1.Variables.Items.Value := QuoteStr( 'USD');
where QuoteStr adds quotation signs to string passed as its param.
Search throug this forum for string variables - there are several comments about this issue.
Mick