calculating within a TfrxMemoView

edited December 2012 in FastReport 4.0
If I want to multiply two Floatvalues from a Dataset I got the Error "(<" is not a valid Integer-Value.

My Expression:
[(<frxDBDataset1."laZeitaufwand">*<frxDBDataset1."KostenBearbeiter">)]

if I use
[<frxDBDataset1."laZeitaufwand">*<frxDBDataset1."KostenBearbeiter">],
I got the same error.

It can't be possible that I must write a OnBeforePrint-Event to do a simple calculation like this one.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 3:54PM
    try
    [((<frxDBDataset1."laZeitaufwand">)*(<frxDBDataset1."KostenBearbeiter">))]

    or try using frs built in expression builder to get your brackets in correct position.
  • edited December 2012
    wrote:
    try
    [((<frxDBDataset1."laZeitaufwand">)*(<frxDBDataset1."KostenBearbeiter">))]
    Error: "((" is not a valid Integer-Value
    wrote:
    or try using frs built in expression builder to get your brackets in correct position.
    are you kidding me?
    if i do that i get [<frxDBDataset1."laZeitaufwand">*<frxDBDataset1."KostenBearbeiter">] without any brackets.
    this expression resolves also in a Error!!!!!!. see my post above.

    and

    this also results in an error: "<f" is not a valid Integer-Value
    [SUM(<frxDBDataset1."laZeitaufwand">)]
    made with the expression-builder
  • gpigpi
    edited December 2012
    Check your field data types and null values
    See report template for FRDemo in attach - [<Customers."Cust No"> * <Customers."Cust No">] expression works OK
  • edited 3:54PM
    smeagol wrote: »
    are you kidding me?
    if i do that i get [<frxDBDataset1."laZeitaufwand">*<frxDBDataset1."KostenBearbeiter">] without any brackets.

    [SUM(<frxDBDataset1."laZeitaufwand">)]
    As far as I can see both formulations should work fine.

  • edited 3:54PM
    If I open the Report within the FR-Designer and after that I click on the Preview-Button it works.

    If I call the Report while my Programm is running (frxReport1.ShowReport) then I got the Convert-Error as I reported above.
    TfrxDBDataset knows all selected fields from the Query. The Fieldtype of "laZeitaufwand" is fftNumeric. The fieldvalue isn't null.

    I use FR Version 4.13.1 with Delphi XE2.
  • edited 3:54PM
    I've found the problem. It seems it was my mistake.

    If you use Expressions like Sum() the event OnNewGetValue was fired. I also have user-defined-variables in the report.
    To make it easier to find out which Varname is requiered (in the OnNewGetValue-Event) my Variables obtain a numeric prefix e.g. 01MyDate, 02MyColor.

    I didn't know about this circumstance and I don't check the Varname. I copied the first two Chars of the Varname and want to convert them to an Integer with StrToInt.

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.