[FX.php List] Getting floating point numbers through FX

Erik Andreas Cayré erik at cayre.dk
Tue Oct 31 15:32:22 MST 2006


I still have this problem...

Den 01/10/2006 kl. 18.19 skrev Gjermund Gusland Thorsen:

> Where did you get the coma "," ?

In the array output from FX.

I have a number field in FM containing numbers like ",7", ",32" etc.
They are formatted in FM as percent, so they are shown as "70%",  
"32%" etc.


> My FMSA outputs period "." as decimal separator

I tried some settings on the layout used by FX, but it didn't change  
anything.

So:
-does the WPE treat all fields as strings?
-or is it FX?
-can PHP use a comma as decimal point (using local settings?)?
-does "Use system formats" have any influence on CWP?

/eac

> ggt667
>
> On 9/30/06, Erik Andreas Cayré <erik at cayre.dk> wrote:
>> Hi all,
>>
>> I've run into a problem getting non-integer numbers from FMSA8.0v4
>> into php.
>> I have no problems with integers, but when the numbers have
>> fractions, I get into trouble...
>>
>> I'm guessing this has to do with how FX parses the XML output from  
>> FMSA.
>> Does anyone now if all data in $FMResult['data'] is represented as
>> strings?
>>
>> This code now works:
>> 1                       foreach ($return_data['data'] as $key =>  
>> $fmrecord)
>> 2                       {
>> 3                               if ($fmrecord['status'] == "paid")
>> 4                               {
>> 5                                       $_SESSION['turnover'] +=  
>> $fmrecord['price'];
>> 6                                       $_SESSION['balance'] +=  
>> $fmrecord['price'] - strtr($fmrecord['avance'], ",", ".");
>> 7                               } else {
>> 8                                       $_SESSION['canceledCount']++;
>> 9                               }
>> 10                      }
>>
>> because on line 6 I added strtr() to transform comma into decimal  
>> point
>>
>> This shouldn't be necessary.
>> Is there a way to set a preference in FX or PHP affecting the type
>> change from string to number?
>>
>> Any related comments?
>>
>>
>>
>> ---
>> Erik Andreas Cayré

---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
DK-6705 Esbjerg Ø

Home Tel: +45 75150512
Mobile: +45 40161183

»If you can't explain it simply, you don't understand it well enough.«
-- Albert Einstein

»If you don't have time to do it right, when will you have time to do  
it over?«
-- John Wooden, basketball coach




More information about the FX.php_List mailing list