locked
Can we customise display of negative numbers> RRS feed

  • Question

  • Dear Friends,

    I am using a regional language font in my form. In that font ascii code 45 (minus sign's ascii) is mapped with different character.  This font has minus sign but its ascii code is 211.

    So the numbers with preceeding minus sign are displayed with that different character.

    If I don't want to change the font, can I display the negative number right way?

    IOW Can I make default minus sign 211 instead of 45?

    -  Ravindra

    Tuesday, May 27, 2014 11:54 AM
    Answerer

Answers

  • There is no SET MINUS or anything like that, but converting the number to string you can finally displaynumberstring=CHRTRAN(numberstring,"-",CHR(211)). You won't be able to recycle any code working on the num,ber as a number, then, you always will need to convert the string back to a number and as first step do the inverse number = VAL(CHRTRAN(displaynumberstring,CHR(211),"-").

    A totally different thing you can do is display negative numbers in brackets, as in accounting via Formatcode @(, but it's not a solution, if your users aren't used to such a notation.

    ? Transform(-9.99,"@(") displays as (         9.99).

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de


    Tuesday, May 27, 2014 1:01 PM
  • Another option is to look under the Control Panel at Regional and Language settings.

    On selecting a country, you can customize settings for Negative sign symbol and negative number format.

    This of course goes right across the PC, rather than just your program.


    The English Bob

    Thursday, May 29, 2014 8:02 AM
    Answerer
  • My further qustion is that can we change the regional settings from VFP? It will help to set and reset this Negative symbol programtically.

    Even if you could do this, I just checked the system setting and it has no influence on VFP, also not on calc.exe. Not with SET SYSFORMATS ON, no way.

    So the only other solution I can think of would be using a font editor and edit the character for the minus sign to be a minus sign.

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de

    Thursday, June 19, 2014 3:31 PM

All replies

  • There is no SET MINUS or anything like that, but converting the number to string you can finally displaynumberstring=CHRTRAN(numberstring,"-",CHR(211)). You won't be able to recycle any code working on the num,ber as a number, then, you always will need to convert the string back to a number and as first step do the inverse number = VAL(CHRTRAN(displaynumberstring,CHR(211),"-").

    A totally different thing you can do is display negative numbers in brackets, as in accounting via Formatcode @(, but it's not a solution, if your users aren't used to such a notation.

    ? Transform(-9.99,"@(") displays as (         9.99).

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de


    Tuesday, May 27, 2014 1:01 PM
  • Could you please tell why do you need this special font to display numbers? If I understand it well you need it for texts. Numbers are displayed in different text fields where you can use different FontName or FontCharSet.

    If you need to change the minus sign in a text then use Olaf's CHRTRAN() recommendation.

    Wednesday, May 28, 2014 10:46 PM
  • Another option is to look under the Control Panel at Regional and Language settings.

    On selecting a country, you can customize settings for Negative sign symbol and negative number format.

    This of course goes right across the PC, rather than just your program.


    The English Bob

    Thursday, May 29, 2014 8:02 AM
    Answerer
  • First of all, I am sorry for the late reply.

    I appreciate all of you for the replies.

    Thank you all.

     To Olaf,

    Your suggestion accomplishes the job. But I have to use this trick each and every time a numeric value is printed. So I will adopt this in 'no other way  out' situation.

    To Pavel,

    I have used that particular font in all my frxs. So to preserve uniformity, I want to use that font for numeric display also.

    To Bob,

    Your suggession is interesting to me. Because it saves my efforts as I dont need to modify my reports. My further qustion is that can we change the regional settings from VFP? It will help to set and reset this Negative symbol programtically.

    Thursday, June 19, 2014 11:47 AM
    Answerer
  • My further qustion is that can we change the regional settings from VFP? It will help to set and reset this Negative symbol programtically.

    Even if you could do this, I just checked the system setting and it has no influence on VFP, also not on calc.exe. Not with SET SYSFORMATS ON, no way.

    So the only other solution I can think of would be using a font editor and edit the character for the minus sign to be a minus sign.

    Bye, Olaf.


    Olaf Doschke - TMN Systemberatung GmbH

    http://www.tmn-systemberatung.de

    Thursday, June 19, 2014 3:31 PM