[GNC] Advanced portfolio report - same stock in multiple investment accounts

Evelyn Yamanaka evelyn.yamanaka at gmail.com
Sat Apr 10 18:50:10 EDT 2021


Hi Mike,

I've modified my Advanced Portfolio report to show the Account Path
(e.g. "Investments:My-Broker:Account-1234") in place of the Listing
(e.g. "NASDAQ"). For me, this is more useful info, and perhaps it
would help with your situation.

On Windows, the Advanced Portfolio report is normally in:
C:\Program Files
(x86)\gnucash\share\guile\site\2.2\gnucash\reports\standard\advanced-portfolio.scm

Look for this line:
          (if show-listing (append! activecols (list
(gnc:make-html-table-header-cell/markup "text-cell" listing))))

Replace with this:
          ;; (if show-listing (append! activecols (list
(gnc:make-html-table-header-cell/markup "text-cell" listing))))
          (let ((name (xaccAccountGetName current))
                (full-name (gnc-account-get-full-name current))
                (offset (string-length "Assets:")))
            (if show-listing
              (append! activecols (list
                  (gnc:make-html-table-header-cell/markup "text-cell"
                    (if (> (string-length full-name) (+ (string-length
name) offset))
                      (substring full-name offset (- (string-length
full-name) (string-length name) 1))
                      "."))))))

Explanation:
If the full account path is "Assets:Mike:Equities:SPY",
then the code will strip out "Assets:" and ":SPY", and place
"Mike:Equities" into the report.

You can change what the code strips out from the beginning by
replacing "Assets:" in the line:
                (offset (string-length "Assets:")))

You can change what the code prints for an account with no parents by
replacing "." in the last line.

Bonus:
          ;; (begin (append! headercols (list (G_ "Listing")))
          (begin (append! headercols (list (G_ "Parent")))

Note if GnuCash ever replaces this report file in a future update,
you'll have to redo these modifications.

-E

On Thu, Apr 8, 2021 at 10:59 AM mike823 <fkjasdhf878 at mailinator.com> wrote:
>
> Hi everyone,
>
> I am using the advanced portfolio report for tracking multiple investment
> accounts for family members, less than 20.
>
> One major issue I am having is that reporting can be done only by "account"
> which is the security and no information about account hierarchy is
> available in the report. As an example, if "user 1" holds MSFT stock in "IRA
> account" and "IBKR margin account" as well, there is no way to see this info
> in the AP report.
>
> Wondering if there is a way to get parent account information in the AP
> report. TIA.
>
>
>
> --
> Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-User-f1415819.html
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.


More information about the gnucash-user mailing list