Error in expression
Hi,
I'm learning about FastReports, to migrate my application where I'm using RaveReports. I'm using C++Builder XE5 and FastReports 4.13.2.
I want to send fixed values from C++Builder to FastReports, so I'm sending values as parameters and trying to show to in the report using a variable, but it fails and I think that there is a problem with the variable that I created inside the FastReport.
In the FastReports IDE I created a Category "Parametros" and a Variable "Saludos". Next I dragged the "Saludos" variable from the Variable tab of the Data Tree to the page.
Now, when I preview the report, it shows the following error message: "The following error(s) have occured: Saludos: Error in expression '': Expression expected".
If I delete this variable from the page and put on it a system variable, as Date for example, then the report is previewed without any problem.
What could be wrong with my own variable?
Regards,
PCerda
I'm learning about FastReports, to migrate my application where I'm using RaveReports. I'm using C++Builder XE5 and FastReports 4.13.2.
I want to send fixed values from C++Builder to FastReports, so I'm sending values as parameters and trying to show to in the report using a variable, but it fails and I think that there is a problem with the variable that I created inside the FastReport.
In the FastReports IDE I created a Category "Parametros" and a Variable "Saludos". Next I dragged the "Saludos" variable from the Variable tab of the Data Tree to the page.
Now, when I preview the report, it shows the following error message: "The following error(s) have occured: Saludos: Error in expression '': Expression expected".
If I delete this variable from the page and put on it a system variable, as Date for example, then the report is previewed without any problem.
What could be wrong with my own variable?
Regards,
PCerda
Comments
In C++Builder I have a TForm with a TEdit and a TButton. In addition, I have a TfrxReport.
This is the code for the TButton click:
frxReport1->Variables->AddVariable("Parametros", "Saludos", Edit1->Text);
frxReport1->ShowReport(true);
I don't use any script language.
The error message that I described is shown at report's designe time, so this code is not used yet, but will be helpful if you suggest how can I write correctly the code in C++.
Regards,
PCerda
Thanks for your suggestions, but it doesn't solved the problem.
If I use your suggested code on my test application on C++Builder, and click the button with the application running, there is the following error message:
Debugger Exception Notification
Project Project1.exe raised exception class $C0000005 with message 'access violation at 0x009c3d34: read of address 0x00000000'.
I insist that the problem is inside of FastReports IDE, because there is an error message before than I start my test application on C++Builder.
I just open the FastReports IDE from the TfrxReport component, create a Category and a Variable, drag this Variable to the report page, click on Preview, and there is the error message:
Error
The following error(s) have occured:
Var: Error in expression '': Expression expected
Well, I have a couple steps forward: changing PascalScript by C++Script solved the described error inside of FastReports; in addition, I founded that if I replace the text value for the Var variable by an integer value (see the following line of code) then the report works well from C++Builder.
The question is: Why it doesn't work with text values?
frxReport1->Variables->Variables["MiVar"] = "\"Test\""; // With this line the report fails
frxReport1->Variables->Variables["MiVar"] = 10; // With this line the report works well
Project Project1.exe raised exception class $C0000005 with message 'access violation at 0x009c3d34: read of address 0x00000000'.
I founded that if I replace the text value for the Var variable by an integer value (see the following line of code) then the report works well from C++Builder.
The question is: Why it doesn't work with text values?
frxReport1->Variables->Variables["MiVar"] = "\"Test\""; // With this line the report fails
frxReport1->Variables->Variables["MiVar"] = 10; // With this line the report works well
Someone could help me please?
I don't know what I'm doing wrong. I can't pass any text (string) to the FastResports; only with integers it works well.
I'm using C++Builder XE5 on Windows10.
Regards,
PCerda
Sorry for my silence so many days, I was focused on another problem.
Thanks for your demo but it does not work on my environment. The behavior is what I described on Nov 2th.
The only way to made it work is using Integer values, but not with String values. The script language was already changed to C++Script.
If I start from scratch and replicate the same simple example, it fails again.
This is very frustrating.
I don't know what else could I try.
Regards,
Patricio Cerda
This is the example test that fails:
frxReport1->Variables->Variables["MiVar"] = "\"Prueba\"";
frxReport1->ShowReport();
Again, if I change the String value for an Integer value everything is Ok, for example:
frxReport1->Variables->Variables["MiVar"] = 1;
frxReport1->ShowReport();
Why it doesn't accept String type variables?
I also try with Variant type but it doesn't work.
In both cases, on the previous environment (C++ Builder on Windows 10) and on this one, I'm using Fusion VMWare 7 on a Macbook Pro.
Any help would be appreciate.
Regards,
Patricio Cerda
or else it triggers the expression evaluator and if it cant resolve it, it then triggers the external ongetvalue event which
means you cant preview in the ide environment.
for an example see the programmers manual.