Passing Values from Delphi to an internal dbxQuery

Hi All,
I try to pass parameter Values to an internal DBXQuery on my Report like this:

frxReport1.Variables := ''''+IntToStr(Kunde)+'''';
frxReport1.Variables := ''''+'KA'+'''';

The variables are defined in the Variables Section of the Report,
The Parameters are in the SQL of the Query (assigned to the Variables).

In the Delphi Debugger the Values appear with 3 quotes.
Showing the report crashes Delphi.

The Information in the programmers Manual is a minimum, I do not understand how to do it correctly.
Would someone please explain to me how to pass an integer / string parameter to an SQL Query inside a Report?

Thank you
Rolf

Comments

  • gordkgordk St.Catherines On. Canada.
    edited January 2017
    where are you calling showreportt from?
    remember when you are trying to assign values to a categorized variable in the report you must run the
    compiled exe created by the project
    if you are already doing this , insteadof calling shown reportcall design report and see what value you have passed into the variable
    the usual error when passing string values is not enough string delimiters
  • edited 3:30AM
    I iterate through the Program until everything is ready, Variables passed, Dataset open , usually when the next thing is "Prepare" or "Showreport",
    then I open the designer and preview the report.

    After receiving your Answer I tried and started the .exe.
    The report is not created.
    No crash.

    Rolf
  • edited 3:30AM
    P.S.
    I use integer values as well, do they have to be passed as strings as well?
  • gordkgordk St.Catherines On. Canada.
    edited January 2017
    nuumeric values do not need delimiters
    passing values to categorized variables

    frxReport3.Variables := 10;
    frxReport3.Variables := ''''+'sometext'+''''; //string
    frxreport3.Variables := ''''+sintkij+''''; // Delphi string variable
    frxreport3.Variables := false; // boolean
  • edited 3:30AM
    How can I check whether the values are accepted?

    I changed the Routines as you wrote.

    The Report (1Page) shows nothing, takes a lot of Time (30 sec.) , as does the following Export.

    No more Crashing.

    In Debugger I get to a procedure "EngineRun" with no result / return to my Program

    Rolf
  • gordkgordk St.Catherines On. Canada.
    edited 3:30AM
    What version of fr are you working with?
    purchased basic, pro, enterprise or embarcadero version or fmx
    send me the code where you are setting up the report
    gord@fast-report.com
  • edited 3:30AM
    gordk wrote: »
    What version of fr are you working with?
    FR 5.11 VCL Professional

    purchased basic, pro, enterprise or embarcadero version or fmx
    send me the code where you are setting up the report
    gord@fast-report.com

    Got a solution. The Parameter is passed by "frxReport1.Variables.Variables := SomeValue.

    Another thing that might help: The unit "frxDBXComponents" is not added to the uses clause automatically, one has to do that by oneself. Might be the case for the other internal DB Components as well.

    Thank you for your help.

    Rolf
  • gpigpi
    edited 3:30AM
    See a demo project in the attach
    wrote:
    Another thing that might help: The unit "frxDBXComponents" is not added to the uses clause automatically, one has to do that by oneself. Might be the case for the other internal DB Components as well.
    Did you add TfrxDBXComponents to project?

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.