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.


Comments

  • LurkingKiwiLurkingKiwi Wellington, New Zealand
    edited 12:36AM
    There is something funny about the way FR handles variables - it has come up before. They appear to be more like script insertions.
    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
  • edited September 2016
    it is worst:
    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.

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.