Hi Lee,
Just another thought about this, something I just remembered now:
There's a way to do this in the SQL shell, by using a function that pulls
an account's corresponding Open directive's metadata.
You'd do something like this, where you attach the clean name as an
attribute (here "name"):

2016-01-01 open Assets:US:BofA:Checking
  name: "BofA Checking Account"

2016-01-01 open Assets:US:Investments:ETrade
  name: "ETrade Investments"

2016-01-01 open Assets:US:Vanguard:Retirement
  name: "Vanguard Retirement Account"

2016-09-11 *
  Assets:US:BofA:Checking   -12000 USD
  Assets:US:Investments:ETrade    50 AAPL {100.00 USD}
  Assets:US:Investments:ETrade    70 MSFT {100.00 USD}

Then you should be able to produce such a report like this:

bean-query clean-account-names.beancount "select
getitem(open_meta(account), 'name') as name, cost(sum(position)) group by 1"

That works:


bean-query
/home/blais/r/q/beancount-data/user/leewanger/clean-account-names.beancount
"select getitem(open_meta(account), 'name') as name, cost(sum(position))
group by 1"
        name          cost_sum_posi
--------------------- -------------
ETrade Investments     12000.00 USD
BofA Checking Account -12000    USD


I hope this helps,
Also, happy to add new functions to the shell if required,






On Wed, Nov 16, 2016 at 11:09 PM, Martin Blais <bl...@furius.ca> wrote:

> On Wed, Nov 16, 2016 at 1:29 AM, Len Wanger <lwan...@gmail.com> wrote:
>
>>
>> Hi,
>>
>> Excuse the newbie question. I am trying to make reports that mimic
>> financial statements for a company. I could use some tips on how to get the
>> reports formatted for external consumption. I am currently working on the
>> balance sheet. A few questions I have:
>>
>> - Is there a way to get the balance sheet report to: 1) show a specified
>> string for an account number, instead of the account name (e.g. account
>> Assets:FixedAssets:Equip to render as "Equipment & Machinery"? Also, is
>> there a way to get the accounts to render in a specified order instead of
>> alphabetical order (e.g I want to have bank accounts, then other current
>> assets, then fixed assets)?
>>
> - To do this do I need to write a custom report in Python? Should I look
> towards the query format? What's the best approach?
>
>
> None of the canned ways to query and report allow you to do this at the
> moment.
>
> I'd recommend you run a query using SQL / bean-query, render to CSV, and
> write a script to insert the lines into your favorite template. If you're
> more ambitious / skilled (at Python), you can also write directly to the
> Beancount Python API. You could reuse this from a script:
> https://bitbucket.org/blais/beancount/src/b969f5f75b699707d50e52d6862489
> 97e5786655/src/python/beancount/query/query.py?at=
> default&fileviewer=file-view-default
>
>
>
>
>>
>> Thanks,
>>
>> Len
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to beancount+unsubscr...@googlegroups.com.
>> To post to this group, send email to beancount@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/beancount/3dc4fc4a-3ec1-46ef-b3d7-2733613be376%40googlegroups.com
>> <https://groups.google.com/d/msgid/beancount/3dc4fc4a-3ec1-46ef-b3d7-2733613be376%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMatKPPmzvU9TW9CY-b3a1-D%3DVpBFi3swZZZbJYW2hjJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to