Format(

Hi,

Having the trouble that

[Format("{0:n}", 0.363309352517986)]

Put in a simple way throws back the error

'Format("{0:n}", 0.363309352517986)': ')' expected

Tried many things with no positive result.

Comments

  • Try [Format('%2.2n', [0.363309352517986])]

  • edited November 2021

    Brauche es für komplex Memo:

    Ich weiß das Memo: ['34.4050291872474' #n%2.2f] gibt 344050291872474.00

    Ich weiß das Memo: [34.4050291872474 #n%2.2f] gibt 34.41

    da #p nicht dabei Funktioniert muss ich auf länger weg erreichen

    Memo: ['eine summe als % = '+ToStr(3831/11135*100)+'%'] gibt:

    eine summe als % = 34.4050291872474%

    FastReport.Net User's manual (fast-report.com) broken?

    Format function - Free Pascal wiki did not help me

    Format String Syntax — fmt 8.0.1 documentation nor did this

    Text Formatting (open-std.org) lost me here

    Python 3's f-Strings: An Improved String Formatting Syntax (Guide) – Real Python nice but no...I'm missing something

    std::fmt - Rust (rust-lang.org) nice but still not getting it to work

    delphi - Inline DisplayFormat of a memo in fastreport - Stack Overflow

  • I do not know what is blocking me from editing my Comments but still to the last ,,delphi´´ did not work for me.

  • here is just the komplex Memo where I am trying to format:

    [IIF(

    SUM((<Gerät."Std_Prüfung.Letzte_Prüfung"> > 0) and (<Gerät."Std_Prüfung.Nächste_Prüfung"> < EncodeDate(YearOf(DATE),(MonthOf(DATE)+1),1)) and (<Gerät."Gefährdungsklassen_Nr"> <> 0) and (<Gerät."Status"> <> 'Ausgemustert'),MasterData1,1)=0,' ','('+

    ToStr(

    SUM((<Gerät."Std_Prüfung.Letzte_Prüfung"> > 0) and (<Gerät."Std_Prüfung.Nächste_Prüfung"> < EncodeDate(YearOf(DATE),(MonthOf(DATE)+1),1)) and (<Gerät."Gefährdungsklassen_Nr"> <> 0) and (<Gerät."Status"> <> 'Ausgemustert'),MasterData1,1)/

    SUM((<Gerät."Status"> <> 'Ausgemustert') and (<Gerät."Gefährdungsklassen_Nr"> <> 0),MasterData1,1)*100 

    )

    +'%)'

    )]

    This works to the point that it gives me a 15 digit floating number, way to much when I need a max of 2 after the comma.

  • Try [Format('%2.2n', [0.363309352517986])]

    Hi sorry, it seems that something went wrong on my side of things with the syntax input. The bigger the complex code the quicker mistakes slip in, I worked it over and it now works.

    [IIF(

    SUM((<Gerät."Std_Prüfung.Letzte_Prüfung"> > 0) and (<Gerät."Std_Prüfung.Nächste_Prüfung"> < EncodeDate(YearOf(DATE),(MonthOf(DATE)+1),1)) and (<Gerät."Gefährdungsklassen_Nr"> <> 0) and (<Gerät."Status"> <> 'Ausgemustert'),MasterData1,1)=0,' ','('+

    ToStr(Format('%2.2n', [

    SUM((<Gerät."Std_Prüfung.Letzte_Prüfung"> > 0) and (<Gerät."Std_Prüfung.Nächste_Prüfung"> < EncodeDate(YearOf(DATE),(MonthOf(DATE)+1),1)) and (<Gerät."Gefährdungsklassen_Nr"> <> 0) and (<Gerät."Status"> <> 'Ausgemustert'),MasterData1,1)/

    SUM((<Gerät."Status"> <> 'Ausgemustert') and (<Gerät."Gefährdungsklassen_Nr"> <> 0),MasterData1,1)*100 

    ]))

    +'%)'

    )]

Leave a Comment