Decimal Problem

Hi,
We are registered users of fast report. We have a very specific requirement. The application that we are developing is used in 2 countries. One country has 3 decimals(eg. 1000.000) in its currency while the other has 2 (eg. 1000.00).

We are using a common frf for both countries. What we require is when the report prints in one country, it should come with 3 decimals while it should come with 2 decimal in the other country. All functions on amounts like SUM, AVG etc should also work correctly. We will be using same Application and frf for both countries. In the application however we will know what the numbers of decimals are.

Any suggestions on this are welcome.

Comments

  • edited 6:06PM
    I think than you must write in script code.

    You can use a delphi variable or a Tfield to pass FR the decimals value, then in script code in all the bands that you need(details, totals, ...) you must to code some thing like:

    if [DECIMALVAR] = 2 then
    memoX.memo.text := formatfloat ('#,##0.00', Tablex.'NUMBER')
    else
    memoX.memo.text := formatfloat ('#,##0.000', Tablex.'NUMBER')

    I hope help you.

    S.Barco
  • edited 6:06PM
    In other post. about FLOAT vars and FormatFloat, Samuray say me:

    1.
    Don't use construction:
    if ([datam.cds."FLOATVAR"] <> null) then // wrong code

    use this code:
    if not FieldIsNull('datam.cds."FLOATVAR"') then // right code


    2. Try to use Memo.DisplayFormat property for float formatting, then
    Memo.DisplaFormat := FormatFloat......


    I hope that's help you, now I'am going to try too.

    S.Barco
  • edited 6:06PM
    Checked your solutions ;) -not working. Can anybody still help ;)
  • edited 6:06PM
    Hi,

    I know it's been a while since you posted your question about the DisplayFormat but I had the same question and received an answer that I am pretty sure will work for you as well.

    See the 'DisplayFormat at run time' topic posted today (Jan 6, 2004) for the answer.

    Kindest regards.
  • edited 6:06PM
    Hi!

    I have the same situation and I solved it on the DB-level. I use FireBird server and there is some stored procedure that will produce the desired output for me based on the selected currency's decimals. There is a currency table where the decimal places are stored for every currency. The procedure only receive the currency code and it does the work. Note that my procedure gives back the values in float format and also in CHAR format and there is no need of formatting inside the FR memos.

    Regards:Alex

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.