This topic is locked

I need decimal like 11.1

5/21/2010 8:55:50 AM
PHPRunner General questions
H
horsey_kim author

I am replacing an old mysql website with a new one using phprunner.
I need to have a field that runs between 1.1 to 30.4 - I have tried variations of fields. It needs to be a numeric type field, not text. Most of the variations I have done, come out in .00 or round off the numbers. I need .0 (only one position after the decimal)
Can anyone give me suggestions on setting up this field. My old database, I used a float field. But it is not an option in phprunner.
Thanks,
Kim

A
ann 5/21/2010

Hi,
open a file source\include\locale.php and change the number of digits after the decimal operator to 1:

$locale_info["LOCALE_IDIGITS"]="1";
H
horsey_kim author 5/21/2010



Hi,
open a file source\include\locale.php and change the number of digits after the decimal operator to 1:

$locale_info["LOCALE_IDIGITS"]="1";




Thanks - but this makes all the fields in my database default to one digit.
I will have several fields, some need to be decimal 2 digit and some decimal 1 digit.
WITH NO rounding either.
example: Horse Height field will be like 15.2 But the price field might be $2500.50 and they might have a score of 12.50.
Kim

H
horsey_kim author 5/21/2010

In Local file, I tried just comment out all the code for fractional digits and under str_fromat_number the line that says this $val=round($val,$locale_info["LOCALE_IDIGITS"]);
It did not work.

H
horsey_kim author 5/21/2010

Not sure how to achieve what I need. I know with my old database I defined in mysql to use float and put the digit requirement 4,1(1 digit after decimal) or 4,2 (2 digit after decimal) and it worked.
Why can't I get this to work in phprunner. Is there a way to turn off rounding and do what I asked in the above.
I don't want to use text to achieve this, I need the fields to sort numeric order and be searchable (less than, more than value and such). So text will not work.

H
horsey_kim author 5/21/2010

Okay I figured a way around it.
I redefined the field as float 4,1 in mysql (not using phprunner) - then I did NOT define the field as number in the EDITOR of phprunner. It seems to let me enter in the number with .1 decimal and it is not changing it. I think if you define the field in phprunner as a number then it will redefine your number for rounding and required decimal places. So far I think this will work.
But I still like to know how to turn off the rounding part, because I know I have a project coming up that I will not want rounding to occur.
Thanks

A
ann 5/24/2010

Hi,
proceed to the Edit as dialog on the Visual Editor tab and change the format to Number. Then you can change the number of digits to 1 in the generated file output\include\locale.php:

$locale_info["LOCALE_IDIGITS"]="1";
H
horsey_kim author 7/1/2010



Hi,
proceed to the Edit as dialog on the Visual Editor tab and change the format to Number. Then you can change the number of digits to 1 in the generated file output\include\locale.php:

$locale_info["LOCALE_IDIGITS"]="1";



Yes I got that to work that way. But the problem is that it makes all the number fields that way. I want some as .00 and some as .0 - so it does not work as I need it.

A
ann 7/2/2010

Hi,
in case you want just show this number as one digital you can proceed to the View as settings dialog on the Visual Editor tab.

Choose custom format and place a code:

$value= number_format($value, 1, ',', ' ');