divide

Hello.
I??m using Delphi 7, Firebird 1.5 and FastReport 2.52.
I have frMemoView with the follow instruction:
FINAL_VALUE :=
[dmdatabase.cdsQryReports."PRICE"] / [dmdatabase.cdsQryReports."QUANTITY"]
EG :
[dmdatabase.cdsQryReports."PRICE"] = 10780000 AND
[dmdatabase.cdsQryReports." QUANTITY "] = 77
But the value of FINAL_VALUE is 14 not 140.000.
But the effect for this formula not for every record, just only 3 of 10 (example) that?s incorrect ?
Why is this happening ?.. ???
Please ....
Thank you for your help

Regards
######

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:12AM
    try adding extra square brackets around calculation and see if that makes a difference
    finalvalue := tn."fn"] / [tn."fn"
    ;)
  • edited 2:12AM
    ;) thank you for your explaination ??¦.
    I have tried for your suggest but the value of FINAL_VALUE is not change yet, the value of FINAL_VALUE still 14 not 140.000

    Format variable memo that I have used was
    Custom format : #,##0.00
    Decimal Digits : 2
    Decimal Separator : .

    Would you like to check again my formula. I wonder my formula or setting was not complete.
    Thank you for your attention.
  • gordkgordk St.Catherines On. Canada.
    edited 2:12AM
    Hi
    look at values
    whole number / whole number
    10780000 / 77 result is 140000

    so your format string is incorrect
    ;)
  • edited 2:12AM
    Hi, thanks for responding,
    I've used the same format to show the value 10780000 in other memo and it shows correctly, which is : 10,780,000.00 exactly what i want.
    But when i put a memo object with statement:
    FINAL_VALUE :=
    dmdatabase.cdsQryReports."PRICE"] / [dmdatabase.cdsQryReports."QUANTITY"

    and for record with value 10780000 / 77 it show value of 14

    I've tried many format string, including the default format and text only. It still the same, it will always shows 14 as value.

    But with other value that show a result that is not a whole number, it will shows correctly, like this:
    3635030 / 2.3120 = 700121.34
    and it shows with the correct value which is 700,121.34

    As i know, this should be formating problem. But i don't know what is wrong.

    Can you help me, what am i doing wrong ;)

    Thank you for your help.
  • gordkgordk St.Catherines On. Canada.
    edited 2:12AM
    When setting a custom format decimal sep and numb of dec is ignored because you are supplying it in the custom format
    2 there is no way, if the db is returning the values you have stated above could the result be 14
    1078 / 77 = 14

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.