How to retrieve the account balance in scm?
    Derek Atkins 
    warlord at MIT.EDU
       
    Wed Jan  4 12:51:21 EST 2012
    
    
  
Hi,
casi <casi at maanreri.de> writes:
> Hi Derek,
>
> thanks for the quick reply. That helped!
>
> (gnc:debug 
>   (let ((num (gnc:gnc-numeric-num (gnc:account-get-balance-at-date acct
> date-val #f)))
>         (denom (gnc:gnc-numeric-denom (gnc:account-get-balance-at-date
> acct date-val #f))))
>        (/ num denom 1.0)))
>
> and returns exactly what I want, for now.
FYI, this would be more efficient if you run:
  (gnc:debug
    (let* ((bal (gnc:account-get-balance-at-date acct date-val #f))
           (num (gnc:gnc-numeric-num bal))
           (denom (gnc:gnc-numeric-denom bal)))
         (/ num demon 1.0)))
This way you don't need to compute the balance multiple times.
>> > Please remember to CC this list on all your replies.
>> > You can do this by using Reply-To-List or Reply-All.
-derek
-- 
       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-user
mailing list