Re: [PATCH] Fix strange behavior when summing rows/columns containing strings

From: Martin Sevior <msevior_at_gmail.com>
Date: Mon Apr 25 2011 - 15:16:05 CEST

Hi Rafal,

Unfortunately your patch doesn't handle the common occurrence of a
currency symbol at the front of the number.

ie If I put in $34.23 in a column with the current code I get a sum
that has a "$" symbol in the front of the number with sum a
row/column. With your patch any number with a leading currency symbol
is ignored as zero.

Can you think of a way to handle this situation? I don't you need to
be too clever as it it is unlikely that more than one currency symbol
will present in a real users table.

If there is, the user will quickly recognize what the limitations of
sum and column/row are and fix things accordingly.

Cheers

Martin

On Sun, Apr 24, 2011 at 10:07 PM, Martin Sevior <msevior@gmail.com> wrote:
> Hi Rafal,
>
> Thanks very much!
>
> Sorry I was away over Easter. I'll take a detailed look tomorrow.
>
> Cheers
>
> Martin
>
>
> On Thu, Apr 21, 2011 at 8:22 PM, RafaƂ KuƂaga <rl.kulaga@gmail.com> wrote:
>> Hi everybody!
>>
>> Attached patch file fixes the problem with strange behavior observed
>> when summing rows/columns containing strings. I have chosen the
>> simplest (and IMO robust) approach - now AbiWord simply skips
>> rows/cells which doesn't contain valid double values. Contrary to the
>> strtod() function, only cells containing valid double values (in
>> standard or scientific notation) followed by whitespaces are summed.
>> Valid values are, in this case, for example:
>>
>> -"8e1   ";
>> -"-80";
>>
>> whereas invalid ones are:
>>
>> -"8e1 20";
>> -"C3PO";
>> -"4t" - strtod() function converts it to 4.000, but we don't want to sum it;
>>
>> This is standard convention used in most of word processors.
>>
>> On the other hand, I have researched the possibility to enable
>> currency and unit symbols for cells. Current implementation of this
>> feature is rather obfuscated and locale-agnostic, which is not very
>> good. It also seems that somebody disabled it, but the whole bunch of
>> if statements is still evaluated. I can clear this.
>>
>> I would be very grateful for any feedback concerning my patch.
>>
>> Regards,
>> Rafal Kulaga
>>
>
Received on Mon Apr 25 15:16:17 2011

This archive was generated by hypermail 2.1.8 : Mon Apr 25 2011 - 15:16:18 CEST