Floats and report variables. How does that work?

Hi,

I have a strange behavior here with Fast Report 4.7 and float values in report variables.

When I assign a float value either this way

Report.Variables[VARIABLE_NAME] := 1.23;

or this

Report.Variables.AddVariable(CATEGORY_NAME, VARIABLE_NAME, 1.23);

I get an Exception 'Memo1: Error in expression '1,23': ';' expected'

Yes, the decimal separator is ",". Is that a bug, a missing configuration or where am I wrong?

Bye, Joe
--

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    what is the text in memo1
    and where are you trying to work from delphi or script code
  • edited 11:30AM
    Hi gordk,
    gordk wrote: »
    what is the text in memo1
    and where are you trying to work from delphi or script code

    Sorry for my short description.

    The code I posted is from Delphi and I get this exception when I start preview from inside the designer.
    The content of the memo is [VARIABLE_NAME] and <VARIABLE_NAME> in the dialog where I pick the variable from.
    There is no script code in the report.

    Regards
    Joe


  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    i would suggest you re read the programmer's manual working with a list of variables.
    you are missing the string delimiters in side the [] braces.
    typically you would modify the variables after loading the report and before calling show or print,
    you cannot just jump into preview from the ide(designer) when you load values from runtime or through userfunction events, or the ogv event.
  • edited 11:30AM
    Hi gordk,

    gordk wrote: »
    i would suggest you re read the programmer's manual working with a list of variables.
    you are missing the string delimiters in side the [] braces.
    typically you would modify the variables after loading the report and before calling show or print,
    you cannot just jump into preview from the ide(designer) when you load values from runtime or through userfunction events, or the ogv event.

    Sorry again, but I thought it to be obvious. VARIABLE_NAME is a literal like 'Amount'.
    So the code would looks like this:

    Report.Variables := 1.23;
    or
    Report.Variables.AddVariable('Name_For_Category', 'Amount', 1.23);

    There is no problem when I assign string values to VARIABLES[], as I normally do with that.
    And of course I loaded the report before, filled the variables, called PrepareReport and then DesignReport. :-)
    Can you assign a double value to a report variable and use it in a simple manner in the report designer and preview the report?


    Regards
    Joe

  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    you can add a dummy value to change later from code
    i don't have any problem with it here.
    just to make sure in your code
    report should be a tfrxreport component or a variable of that type and the report file should be loaded first
    before trying to modify the variables or object properties.
  • edited June 2009
    Hi gordk,
    gordk wrote: »
    you can add a dummy value to change later from code
    i don't have any problem with it here.
    just to make sure in your code
    report should be a tfrxreport component or a variable of that type and the report file should be loaded first
    before trying to modify the variables or object properties.

    Yes, I ckecked this before. With a report (TfrxReport) on the form and the report itself stored in the DFM I run into the problem with this code:

    Report.Variables := 1.23;
    Report.PrepareReport;
    Report.DesignReport;

    In desgin mode choose preview to get the exception. The simple test project is in http://galinke.com/joefr.zip

    But you can reproduce it more easy when changing the decimal separator to "," before starting the application. It works here if I change the decimal separator to a dot. The thing is, that I can't use this as a workaround.

    If I didn't miss a configuration/property for this, I'd call it a bug.

    Regards
    Joe


    P.S.: Bug or not? :-)
    May be one shouldn't call .PrepareReport when .DesignReport will be used later.
  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    definetly not
    you only call design if you want to design
    prepare creates the output of the design, the same as show, except that it does not display the preview.
    what you use for a decimal separator will depend upon which language and settings your system is using.

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.