#### FastReport and Variables

Hello Folks!

I have defined a FastReport with Delphi XE2 and now I need to make some content configurable. I introduced a variable inside the report called [ProviderNumbers] and set the content before preparing the report. But neither of the two methods I could find in the documentation work:

{code}
frxInvoiceReport.Variables.Variables['ProviderNumbers'] := 'Test';
frxInvoiceReport.PrepareReport;
frxInvoiceReport.Export(frxPDFExport);
{code}

{code}
frxInvoiceReport.Script.Variables['ProviderNumbers'] := 'Test';
frxInvoiceReport.PrepareReport;
frxInvoiceReport.Export(frxPDFExport);
{code}

Here is the call stack of the exception when calling prepare report:

{code}
:74e5b727 KERNELBASE.RaiseException + 0x58
:004cf38f Call_HookedRaise + $A7 frxClass.TfrxReport.Calc('',???) frxClass.TfrxReport.DoGetValue('ProviderNumbers',Null) frxClass.TfrxReport.Calc('ProviderNumbers',$36058C0)
frxClass.TfrxCustomMemoView.CalcAndFormat(???)
frxClass.TfrxCustomMemoView.GetData
frxEngine.TfrxEngine.Stretch($3581310) frxEngine.TfrxEngine.DoShow($3581310)
frxEngine.TfrxEngine.ShowBand($3581310) frxEngine.ShowBandTree(???) frxEngine.ShowPage frxEngine.TfrxEngine.RunPage(???) frxEngine.DoPages frxEngine.TfrxEngine.RunReportPages frxEngine.TfrxEngine.Run frxClass.TfrxReport.PrepareReport(???) DAppointmentMethods.TdmoAppointmentMethods.CreateInvoice(13,nil) {code} And here is the definition of the FR variable form the DFM file: {code} Variables = < item Name = ' Settings' Value = Null end item Name = 'ProviderNumbers' Value = '' end> {code} Are variables supported in the FastReport version that comes with Delphi XE2? Salut, +Mathias+   0 Mathias 3/20/2012 1:05:24 AM embarcadero.delphi.reporting 487 articles. 0 followers. 4 Replies 6586 Views Similar Articles [PageSpeed] 7 IIRC, It should be Variables['ProviderNumbers'] := '''Test'''; This way you pass a string variable 'Test'. Otherwise it's identifier/literal Test. Variables are parsed when passed to Variables property, not assigned. Maxim > {quote:title=Mathias Burbach wrote:}{quote} > Hello Folks! > > I have defined a FastReport with Delphi XE2 and now I need to make some content configurable. I introduced a variable inside the report called [ProviderNumbers] and set the content before preparing the report. But neither of the two methods I could find in the documentation work: > > {code} > frxInvoiceReport.Variables.Variables['ProviderNumbers'] := 'Test'; > frxInvoiceReport.PrepareReport; > frxInvoiceReport.Export(frxPDFExport); > {code} > > {code} > frxInvoiceReport.Script.Variables['ProviderNumbers'] := 'Test'; > frxInvoiceReport.PrepareReport; > frxInvoiceReport.Export(frxPDFExport); > {code} > > Here is the call stack of the exception when calling prepare report: > > {code} > :74e5b727 KERNELBASE.RaiseException + 0x58 > :004cf38f Call_HookedRaise +$A7
> frxClass.TfrxReport.Calc('',???)
> frxClass.TfrxReport.DoGetValue('ProviderNumbers',Null)
> frxClass.TfrxReport.Calc('ProviderNumbers',$36058C0) > frxClass.TfrxCustomMemoView.CalcAndFormat(???) > frxClass.TfrxCustomMemoView.GetData > frxEngine.TfrxEngine.Stretch($3581310)
> frxEngine.TfrxEngine.DoShow($3581310) > frxEngine.TfrxEngine.ShowBand($3581310)
> frxEngine.ShowBandTree(???)
> frxEngine.ShowPage
> frxEngine.TfrxEngine.RunPage(???)
> frxEngine.DoPages
> frxEngine.TfrxEngine.RunReportPages
> frxEngine.TfrxEngine.Run
> frxClass.TfrxReport.PrepareReport(???)
> DAppointmentMethods.TdmoAppointmentMethods.CreateInvoice(13,nil)
> {code}
>
> And here is the definition of the FR variable form the DFM file:
>
> {code}
> Variables = <
>   item
>     Name = ' Settings'
>     Value = Null
>   end
>   item
>     Name = 'ProviderNumbers'
>     Value = ''
>   end>
> {code}
>
> Are variables supported in the FastReport version that comes with Delphi XE2?
>
> Salut,
>   +Mathias+

 0
Maxim
3/20/2012 5:31:15 AM
Hello Maxime,

{quote:title=Maxim Shiryaev wrote:}
IIRC,
It should be Variables['ProviderNumbers'] := '''Test''';
This way you pass a string variable 'Test'.
Otherwise it's identifier/literal Test.
Variables are parsed when passed to Variables property, not assigned.
{quote}

Yep, have discovered the paragraph on page 31 of the FR 4.6 programmers manual. Thanks for your hint.

Salut,
+Mathias+

 0
Mathias
3/20/2012 5:42:48 AM
> Yep, have discovered the paragraph on page 31 of the FR 4.6 programmers manual. Thanks for your hint.

Could you provide a link for that manual? I've only been able to find the users manual.

 0
jesu
3/21/2012 2:37:14 AM
Hello Jesu,

{quote:title=jesu ortega wrote:}
Could you provide a link for that manual? I've only been able to find the users manual.
{quote}
Have a look  here:
http://www.fast-report.com/en/documentation/frx3progr/Working%20with%20TfrxReport%20component/Modifying%20the%20variables%20value.htm

I ended up using an INI file section to store provider numbers and assign the FR variable before preparing the report. Here is how I have done it:

{code}
frxVar := frxInvoiceReport.Variables.Items[1];
frxVar.Value := BuildProviderNumberVariableString;
{code}

with BuildProviderNumberVariableString being implemented in the same class like this:

{code}
function TdmoAppointmentMethods.BuildProviderNumberVariableString: string;
var
i: Integer;
begin
Result := '';
for i := 0 to svrContainer.ProviderNumbers.Count-1 do
begin
if svrContainer.ProviderNumbers.ValueFromIndex[i] <> EmptyStr then
Result := Result + Format('''%s - %s''#13#10', [svrContainer.ProviderNumbers.Names[i],
svrContainer.ProviderNumbers.ValueFromIndex[i]])
else
Result := Result + Format('''%s''#13#10', [svrContainer.ProviderNumbers.Names[i]]);
end;
Result := Copy(Result, 1, Length(Result)-6);
end;
{code}

So I did manage to use CRLFs in the FR variable.

Salut,
+Mathias+

 0
Mathias
3/21/2012 3:47:37 PM

Similar Artilces:

ANN: Delphi HTML Reports preview
Very simple to use - buid complex reports in 10 minutes. All you need to know - SQL, HTML, CSS. Use all power of HTML4 and CSS3 in any part of report. Features: Barcodes Multiline headers Groups Cross-tabs (any level) Transformations (cross-tab with range) Pictures (+from database) Master/Detail (any level) Supports all databases and db-libraries (writing adapter for any db-acess library takes only 5 minutes) Standalone reports - no need for delphi forms/datasets. 100% native Delhi code. All Delphi versions - from Delphi 6 to XE6 (VCL). 32/64 bit. Supports Unicode for...

FastReports with Delphi
Hi, I'm a Delphi XE2 user and am considering using FastReports which comes with XE2. I've used QuickReport in the past and I have a couple of questions. Firstly can reports with FR be designed and compiled into the EXE as they are with QR, or does it require them to be distributed as separate files? Also I often used the events in QR (OnBeforePrint etc) but I read somewhere that events in FR are not available with the version that comes with XE2 - is this correct? Many thanks, Jonathan Jonathan Wareham wrote: >Hi, > >I'm a Delphi XE2 user and am considerin...

View Microsoft Reporting Services Reports in Delphi
Do you ever think (or can) Delphi take the leap of providing a report viewer for Microsoft Reporting Services RDL reports. I have been using Fast Reports for years. Recently I have been developing MS Reports and Cubes. This is a far better alternative for developers and end users than the current solutions written for Delphi. Can someone comment on this or provide an alternative for me? Or even better provide me with a product that 3rd party product that can view ms reports. Delphi need to take the next step in medium to enterprise reporting and what I see, lags behind in this department. ...

Variable Variables
Hi, Maybe the solution is very simple, but how do I create variable variables in vb.net? I want to use the value of a variable as a part of the name of another variable. A very simple example below: code: Dim a As String a = "1" Label a.Text = "hi" page: <asp:Label id="Label1" runat="server">Label</asp:Label> In need this to change a range of values by using just one loop. I can´t do that without creating a variable variable name. Hi, check out this little demo application I created for you: ...

Delphi report
Hello, Is there any FREE reporting tools for Delphi other than QuickReport and Freereport ? Thank you Dear Mike Thomas! Also you can use internal in Delphi Rave Reports :) Or use non-free report generators like FastReport (price starts from \$79). Try to find free/chipper but better... "Mike Thomas" wrote: news:169748@forums.codegear.com... > Hello, > > Is there any FREE reporting tools for Delphi other than QuickReport and > Freereport ? > > Thank you -- Best regards, Michael Philippenko mailto:michael@fast-report.com Fast Repor...

variable of variables
Say I have 2 scenarios and I want to use a different variable depending on which scenario applies without coding this logic. So I could have a database table t_variables which has: Scenario: Variable: --------- -------- 1 v_name 2 v_company In my Powerbuilder code I'd have values in v_name & v_company. What I'd like to be able to do is to select which variable to use from the table and assign that to something, e.g. select variable into v_variable from t_variables where scenario = 1 so at this point v_variable would be 'v_name'...

variable not a variable
Error:Must declare the variable '@cartDateTime'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@cartDateTime'. Dim connStr As SqlConnection            Dim cmdInsert As SqlCommand            Dim strInsert As String      &n...

variable variables?
Hello! How to make a variable receive an increment in the name? I want to do it for example: I have: Label1->Caption = "1"; Label2->Caption = "2"; Label3->Caption = "3"; Label4->Caption = "4"; And I want to do something like that: for (i=1; i<5; i++) { Label+i->Caption = i; } Any idea? Can I do something like that? Thanks and regards Alexandre Create a vector of pointers to the various objects. In your case below, construct a vector (called Labels) of pointers to TLable long enough to hold pointers to...

Variables in Delphi
Hello, I have an application that needs to get same values on fly, for example configuration values, like company name, address, phone, plus about 120 other variables, all screen has relation and uses some or all those variables. Right now, I put all variables on data model form, and fill those variables from the database on create, then I use them as needed. My questions are: 1-Does those variables harm or effect user’s performance as memory loss,? 2-Is there better way to do this kind variable and where is the better place for them? 3-Is variable hack-able? 4-Is variable has bi...

First Aid on Crystal Report, Definition of Report Variable Reference
How do I define the variable that holds the reference returned by the OpenReport function call ? OLEObject ole_Object ????? REPORT ole_Object = CREATE OLEObject ole_Object.ConnectToNewObject("crystal.crpe.application") ???? REPORT = ole_Object.OpenReport("C:\pm2000\reports\country.rpt") ???? REPORT.Preview() Thanks for any help !! Turid :-) ...

Delphi 2009 automatic bug reports appear as Delphi.NET issues
For automatic bug reports, Delphi 2009 seems to put 'Delphi.NET' into the field for 'Project'. I will try to verify it and enter it in QC. Unfortunately this means I have to use the QC database for 'testing', but will delete my test entries if I have verified the problem. Michael Justin Michael Justin wrote: > For automatic bug reports, Delphi 2009 seems to put 'Delphi.NET' into > the field for 'Project'. AFAIK this is as expected. There is no project "RAD Studio" and so "Delphi.NET" has been choosen as proj...

about report reports generation and emailing reports
hi i am a bit new to Bugzilla, i am using 2.18rc3version. and i am facing two problems with report generation. 1) the checksetup.pl shows all the perl modules includig optional perl modules to be installed and available including thse required for graphical report generation. but despite this i am able to get tabular reports generated but when i click for line/bar reports of the same tabular report the next page does not show the required pie/bar reports. 2) is there any facility for sending these generated reports to the client via email through Bugzilla? kindly help. regards...

Converting Crystal Reports 9 report to Crystal Reports .NET report
I have a web page that is supposed to display a crystal report.  The report is fully written and functional in crystal 9 (non-.Net)  .  Is there a way to convert my .rpt so that I can just include it in the new web site? why you don't try to compile project with .net and include your report. then if crystal report is power tool will suggests you with conversation tool    My blog is here.Please remember to 'Mark as Answer' if this post answered your question! Wow it really was that easy!  I just added the old crystal report into my .NET proj...

Passing variables to reports
I have just mastered report parameters, which allow the user to enter parameters while running the report.  Now I need to be able to pass parameters to the reports myself, which the user has no ability to change (basically depending upon the user group that the user is in, they will view a different subset of the data).  Is this possible?...

Web resources about - FastReport and Variables - embarcadero.delphi.reporting