variables
using FR5.4.4 c++ builder xe10 seattle.
I have a report with a TfrxMemoView holding [subtitle] named Memo6, and another TfrxMemoView holding [labcol3] named Memo2.
Both TfrxMemoView are present in report header. This report also holds a dataset/detail band.
In the app:
Query1->Active=true;
frxReport1->LoadFromFile("c:\\reps\\RepInventories.FR3");
frxReport1->Variables->Clear();
frxReport1->Variables->Variables[L" My Category 1"] = NULL;
frxReport1->Variables->Variables[L"subtitle"]=L"";
frxReport1->Variables->Variables[L"labcol3"]=L"project";
frxReport1->ShowReport();
=> if I run this, I get 'The following error(s) have occured: Memo6: Error in expression '': Expression expected.
If I set frxReport1->Variables->Variables[L"subtitle"]=L"aaa";
=> if I run this, I get 'The following error(s) have occured: Memo6: Error in expression 'aaa': undeclared identified aaa
frxReport1->Variables->Variables[L"subtitle"]=L"adress line1\r\nadress line 2\r\n";
=> if I run this, I get the address displayed then The following error(s) have occured: Memo9: Error in expression 'Project': Undeclared identifier: 'Project'.
There is no Memo9 in the .fr3 file.
I just want to display the content of the variable (even if empty), without any intelligence. What's wrong?
Thanks.
I have a report with a TfrxMemoView holding [subtitle] named Memo6, and another TfrxMemoView holding [labcol3] named Memo2.
Both TfrxMemoView are present in report header. This report also holds a dataset/detail band.
In the app:
Query1->Active=true;
frxReport1->LoadFromFile("c:\\reps\\RepInventories.FR3");
frxReport1->Variables->Clear();
frxReport1->Variables->Variables[L" My Category 1"] = NULL;
frxReport1->Variables->Variables[L"subtitle"]=L"";
frxReport1->Variables->Variables[L"labcol3"]=L"project";
frxReport1->ShowReport();
=> if I run this, I get 'The following error(s) have occured: Memo6: Error in expression '': Expression expected.
If I set frxReport1->Variables->Variables[L"subtitle"]=L"aaa";
=> if I run this, I get 'The following error(s) have occured: Memo6: Error in expression 'aaa': undeclared identified aaa
frxReport1->Variables->Variables[L"subtitle"]=L"adress line1\r\nadress line 2\r\n";
=> if I run this, I get the address displayed then The following error(s) have occured: Memo9: Error in expression 'Project': Undeclared identifier: 'Project'.
There is no Memo9 in the .fr3 file.
I just want to display the content of the variable (even if empty), without any intelligence. What's wrong?
Thanks.
Comments
The documentation states that you must put quotes around the variables CONTENTS else it will be processed recursively like script.
I guess in C that would be "\"contents\"".
Note that, as you have observed, if the string contains a LF (maybe its a CR) then it prints correctly - in this case, the extra quotes are printed as well!!!!
See:
http://www.fast-report.com/en/forum/?p=/discussion/12466
http://www.fast-report.com/en/forum/?p=/discussion/13462
the field with cr/lf: the " appears on the report.
For the other field :The following error(s) have occured: Memo2: Error in expression '"Project"': Expression expected. Notice '"Project"' instead of 'Project'
Seems to work if
* when value doesn't hold crlf=> frxReport1->Variables->Variables["name"]="'"+Value+"'";
* when value holds crlf=> frxReport1->Variables->Variables["name"]=Value;
Thanks anyway.