This topic is locked

decimals and percentage

11/15/2006 8:56:56 AM
ASPRunnerPro General questions
M
maurello author

I already noticed several weeks back that the "view as..." percentage did not work. If selected nothing is displayed in the field, although it is populated.
Moreover, it would be nice to have the possiblity to define as a property of the "view as..." number, how many decimals to display. The default value is 2. I tried to do it even manually changing the aspfunctions.asp as suggested in another post, but it seems like ASP Runner does not take into account that modification and keeps publishing every number (stored in my SQL Server as int) with 2 decimals.
Do we have a solution to the two issues above ?

Sergey Kornilov admin 11/15/2006

Mauro,
aspfuntions.asp is no longer in use in version 4.1.
If you have any issues send me your files along with instructions on reproducing those errors.

Before doing this make sure sure you use the latest version of ASPRunnerPro.
To change number of decimal points after comma use Custom View type and the following:

strValue = FormatNumber(strValue,4)
M
maurello author 11/16/2006

Thanks! I've done it.
How about the percentage? I tried to use strValue = FormatPercent(strValue) but the it doesn't work. The field displayed is empty as if the value was NULL, which is not of course.
Any suggestion?

Sergey Kornilov admin 11/16/2006

For percent values use View type percent or Custom code:

if isNumeric(strValue) or vartype(strValue)=14 then strValue = (CDBL(strValue) * 100) & "%"
M
maurello author 11/17/2006

View Type percentage does not work with ASP Runner 4.1. If selected nothing is displayed although the field is populated and the the numbers are stored in the correct format in the database, i.e. 0,## or 1
I will try to use the Custom code.
Thanks!

Sergey Kornilov admin 11/17/2006

Mauro,
please contact me directly at support@xlinesoft.com regarding View as Percent issue.
I need to know what build of ASPRunnerPro you use, what is your database and what is the field type.
We had an issue with View as percent on decimal fields in SQL server however it was fixed a couple of weeks ago.

Alberto 8/9/2007

I just solved my similar problem by using the next:
strValue = FormatNumber((CDBL(strValue) * 100)) & "%"
it would be nice to have the option of indicating the number of decimal positions to money, numeric and percentage directly using the editor. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=20312&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
Thanks