How to retrieve the account balance in scm?

casi casi at maanreri.de
Mon Dec 26 08:02:58 EST 2011


Hi,

GnuCash 2.4.7, on Ubuntu 11.10

trying to get familiar with customizing reports directly in Scheme, I
managed to get into the language deep enough to get the clou out of
hello-world.scm (working and playing around with my private copy).

hello-world.scm tells you a lot about how to set and retreive options
and values for a report, but it does not tell you much about how to make
use of them.

Starting with the very basic (as I thought) I tried to read from the
standard reports how to do this - but this is not really obvious to me
(I am looking at account-summary.scm and cash-flow.scm, maybe not
clever?).

Finally, I got down to calling
"(gnc:account-get-balance-at-date acct date-val #f)"
and the debug print out shows the return value as
"#<<gnc-numeric> num: -53065 denom: 100>"
and here I get stuck as I don't find any syntax explanation for
"#<...>".

(Well, I do understand that the account balance is -53065/100 ->
-530.65, which is correct.)

I tried to interpret "#<<gnc-numeric> num: -53065 denom: 100>" as
- string
- list
- vector
(- even tried "numerator ...")
neither of which seems to work (and unfortunately gnucash.trace only
shows what input type is expected, but not what it actually got).

So here comes my question:
How can I get the numerical account balance value from "#<<gnc-numeric>
num: -53065 denom: 100>" ?

If there is even a smarter way to get to the same result, feel welcome
to give me that hint :-)

Thx and advance,
Carsten



More information about the gnucash-user mailing list