GnuCash XML sched-xaction split amount formatting

Derek Atkins warlord at MIT.EDU
Wed Apr 29 10:40:04 EDT 2015


Ngewi Fet <ngewif at gmail.com> writes:

> Hi Geert,
> Thanks for that info. That puts us in a tight spot. Now GncA could either:
> - skip scheduled transactions completely (not desirable)

Why is this not desireable?

> - parse the wrong amount and let the user edit it later (I am less inclined
> to do this) or
> - fail the import completely (which is what happens now and will make the
> import feature less-than-useful for many) .
>
> One solution that comes to mind though, if I could reliably know how many
> decimal places are included in the amount, then I can parse it irrespective
> of the separator.
> Does GnuCash always use 2 decimal places, or does this depend on the
> currency, or something else?

I think it depends on the currency.

> But then that also leaves the issue of GnuCash choking on XML files
> exported by GncA because we cannot predict what locale the user will be
> using.
> Best guess will be to use the mobile device locale and hope that the user
> has the same setting on the desktop!

I suspect this is a *reasonable* assumption, but of course it wont work
always.

Perhaps you should just ignore SXes completely?  The data is stored in a
KVP, so just treat as the string it is.  You wont lose data, you just
wont *use* it.

> Regards,
> Ngewi F.

-derek

> On Wed, Apr 29, 2015 at 12:42 PM, Geert Janssens <geert.gnucash at kobaltwit.be
>> wrote:
>
>>  On Wednesday 29 April 2015 11:35:42 Ngewi Fet wrote:
>>
>> > Hello,
>>
>> > In GnuCash XML, scheduled transaction splits do not have the
>>
>> > <split:value/> and <split:quantities/> set. Rather the amount is
>>
>> > stored as a slot with key <sched-xaction>.
>>
>> >
>>
>> > I would like to know if the formatting of this amount is (device or
>>
>> > gnucash) locale-specific, or uniform across all GnuCash instances.
>>
>> >
>>
>> > For me, it is formatted as , e.g. 200,00 or 2.500,00
>>
>> > Note the comma for decimal separator and period for thousands
>>
>> > separator (which would be correct for my device locale but incorrect
>>
>> > for my GnuCash locale which is en_US).
>>
>> > The formatting doesn't seem to change when I modify the GnuCash
>>
>> > locale.
>>
>> >
>>
>> > Can anyone shed some light on the formatting of the split amounts of
>>
>> > scheduled transactions?
>>
>> > It would help when parsing GnuCash XML files in GnuCash Android.
>>
>> > Thanks.
>>
>> >
>>
>> > Regards,
>>
>> > Ngewi F.
>>
>> > _______________________________________________
>>
>> > gnucash-devel mailing list
>>
>> > gnucash-devel at gnucash.org
>>
>> > https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>>
>>
>>
>> Hi Ngewi,
>>
>>
>>
>> Unfortunately you hit one of GnuCash's dark corners here. The SX amount
>> formula is stored in gnucash in the locale that is active at that time.
>> This has been a poor design decision (more like on oversight probably) at
>> the time.
>>
>>
>>
>> It gets worse if you change locales afterwards because gnucash doesn't
>> store the locale information itself with the formula and hence can't
>> convert the stored formulas to the new locale, resulting in errors when
>> these formulas have to be parsed.
>>
>>
>>
>> This has been reported as a bug [1] which hasn't been fixed yet so far.
>>
>>
>>
>> I'm not sure what you can do on the gnucash-on-android side to properly
>> handle this if gnucash itself even doesn't.
>>
>>
>>
>> Geert
>>
>>
>>
>> [1] https://bugzilla.gnome.org/show_bug.cgi?id=370331
>>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list