This topic is locked

How to remove/hide '0' values in number fields?

1/26/2006 7:49:48 PM
ASPRunnerPro General questions
Pete M author

Hi,
I have a reporting application with tables of number fields formatted as currency.
Some of these numbers are zero, and I would like to have these shown as a blank record rather than £0.00
Is this easy to implement?
Thanks
Pete

Sergey Kornilov admin 1/26/2006

Pete,
you can modify GetData function in include/aspfunctions.asp file the followng way:

if Format = FORMAT_CURRENCY and GetData<>"" then

if Clng(GetData)>0 then GetData = FormatCurrency(GetData) else GetData="" end if
Pete M author 1/27/2006

Thanks Sergey <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=7764&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
I found this code worked:

if Format = FORMAT_CURRENCY and GetData<>"" _

then if Clng(GetData)>0 then GetData = FormatCurrency(GetData) else GetData="" end if


Pete

Pete M author 2/11/2007

Hi,
Sorry to bring this old topic up, but I can't get this code to work any more, and wondered if anything has changed in this regard over the last year?
I would like to have zero entries in currency fields to show as a blank, rather than $0.00
Thanks,
Pete

Pete M author 2/13/2007

Is this possible please? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=15498&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

J
Jane 2/15/2007

Pete,
you can do it using Custom format on the "View as" settings dialog on the Visual Editor tab in the ASPRunnerPro 4.1.

Here is a sample of custom expression:

if strValue=0 then

strValue=""

else

strValue = FormatCurrency(CDbl(strValue))

end if

Pete M author 2/15/2007

Thanks for that Jane, that's worked for the cell values.
The only problem is that now the column totals are no longer formatted as currency, but plain numbers.
Can the totals column be formatted using the custom type, or can it be formatted as currency type independently of the cells ion the table?
Thanks again,
Pete

J
Jane 2/16/2007

Pete,
just open ..._list.asp file, find this line:

' show totals

smarty.Add "showtotal_FieldName", GetTotals(totals("FieldName"),"TOTAL",recno-1,"Custom")

and replace it with this one:

' show totals

smarty.Add "showtotal_FieldName", GetTotals(totals("FieldName"),"TOTAL",recno-1,"Currency")



where FieldName is your actual field name.

Pete M author 2/17/2007

Thanks Jane,
Regards
Pete