locked
Is there a way to non-display 0 values on a screen using Format Patterns? RRS feed

  • Question

  • I have several screens where I have numerous decimal fields displayed.  When they are 0 I know I can write code to not show the "0" but this is quite time consuming.  I couldn't really see anything in the format patterns that would accomplish this but I might be overlooking something obvious.  Thanks much for any help.

    Vern Miller

    Monday, June 24, 2013 1:44 PM

Answers

  • I think I stumbled onto it if anyone runs into the same problem.  #,##0.##;(#,##0.##);'zero' which I changed to #,##0.##;(#,##0.##);' '

    Vern Miller

    • Marked as answer by VernMiller Wednesday, June 26, 2013 3:50 PM
    Wednesday, June 26, 2013 3:49 PM

All replies

  • I think I stumbled onto it if anyone runs into the same problem.  #,##0.##;(#,##0.##);'zero' which I changed to #,##0.##;(#,##0.##);' '

    Vern Miller

    • Marked as answer by VernMiller Wednesday, June 26, 2013 3:50 PM
    Wednesday, June 26, 2013 3:49 PM
  • I have done some research and the pattern #,##0.##;(#,##0.##);' ' seems to suppress the 0 fields just fine.  The only problem is that it suppresses trailing zeroes. 135.20 shows 135.2 and 135.00 shows 135.  It's probably a simple fix but possibly someone has an idea for me. Thanks.

    Vern Miller

    Friday, July 26, 2013 1:17 PM
  • Hello

    I think that you are overlooking the obvious. The "#" within your pattern denotes any numeric value or nothing whereas the 0 denotes a numeric value. So if you were looking to show all values to 2DP even if they were blank I would use #,##0.00;(#,##0.00)


    If you found this post helpful, please mark it as helpful. If by some chance I answered the question, please mark the question as answered. That way you will help more people like me :)

    Friday, July 26, 2013 3:11 PM
  • That would show 0.00 for 0 values and I really want to show blank if the field is 0.  Like I said above the formula does that but sheds the zeroes after the decimal point.

    Vern Miller

    Friday, July 26, 2013 5:51 PM
  • Hi,

    it depends whether the property is optional or not. If it's optional then the property actually is nullable (e.g. double?) if it's not optional it's not nullable (e.g. double).

    If the property is nullable (optional), and the user never defined a value or cleared the value in the textbox, then it is acually null (C#)(VB: Nothing), in this case it would show just a blank field.

    regards

    Oliver




    • Edited by OlimilO Saturday, September 7, 2013 2:43 AM
    Saturday, September 7, 2013 2:20 AM