undeclared identifier "frvariables"

Hi

I am trying to pass a string to my report using form2.frreport1.frvariables:='2351';

but i get a compiler error undeclared identifier "frvariables" if i leave the line out my everything else works fine.

Can you suggest what I am doing wrong?

Thanks
Pete
PS
It is freereports that I am using

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:07AM
    Hi Pete
    from faq.txt
    2.25. How to pass a value to the report?
    *************
    There are several methods to do this. First is to use global object
    frVariables (defined in FR_Class unit):

    frVariables := 10;
    *****Note no dot notation in front of frvariables but do it after loading a report.
    **** also as noted below watch the string value passed in in some cases you must wrap with ''''+ 'strval' +''''


    This code creates a new variable with 'My variable' name and value = 10.
    This method is best to pass static data to the report.

    Second method is to use the TfrReport.OnGetValue event. You can use this
    method to pass dynamic data, i.e. data that changes from record to record.

    procedure TForm1.frReport1GetValue(ParName: String; var ParValue: Variant);
    begin
    if ParName = 'MyField' then
    ParValue := Table1MyField.Value;
    end;

    Finally, third method is to define variable from dictionary programmatically:

    with frReport1.Dictionary do
    begin
    Variables := 'CustomerData.Customers."CustNo"';
    Variables := '10';
    end;


    (can I pass data from report to the program?)

    Use frVariables object. If you write the following code in any script:

    MyVariable := 10

    then in your program you can use this code to retrieve MyVariable value:
    v := frVariables;
    ;)
  • ajuaju
    edited 8:07AM
    hi gord,
    and how does that work in bcbuilder(6). I always get compiler errors...
    Something like : can't convert from char* to int,
    TfrVariables::operator=(int) not found...

    Thanks and regards,
    Andi

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.