Investment Studio > Views > Portfolios > Grid fields

For generic help on Grid record definitions, see

Record definition editor
Grid data types
Expressions
Alphabetic function reference

The following notes are specific to the Portfolios view's Grid object. Click in its toolbar or use Customize > Setup in its pop-up menu to open the record definition editor.

This Grid's primary purpose is to provide direct access to Investment Studio's internal table of selected portfolios. Its record definition should therefore contain at least one Portfolio type field (Why? See the discussion of lookup record fields!).
In most cases, portfolio name, symbol and currency should all be exposed and editable.
Include an editable Color-type custom property called "_COLOR" in the Grid's record definition to tell Chart and Graph objects which color to use for each portfolio (when Autocolor is enabled).
Chart and Graph expressions can access Grid field values for the selected portfolio using the "GRID" symbol qualifier, as in "GRID._NAV".
Use the special symbols FROM_DATE and TO_DATE to find out the view's current date range, as set in the toolbar (e.g. to get portfolio NAVs and compute returns over the time frame being displayed). Since up-to-date NAVs may not be available, the dates of the actual quotes should always be provided too.
Use the special symbol SELECTED to get the index of the selected portfolio in Investment Studio's internal table of loaded portfolios. This allows comparisons to be made between each portfolio (identified by the value of any Portfolio type field in the Grid's record definition) and the selected portfolio (identified by SELECTED). For instance, you could compare relative strengths or compute portfolio correlations and have them automatically recomputed whenever a new portfolio (or a new date range) is selected in the Grid.
Comparisons across portfolios can also involve a fixed portfolio rather than the SELECTED one. Since portfolio indices may change at any time, they can not be specified using constants, but they can be obtained by a simple trick. The following expression will return the index of the portfolio with symbol "TEST" (or #N/A if no such portfolio is found):

=match("TEST", mop("portfolio_symbol()", makevector(1000, 0, 1)), 0) - 1

This expression assumes that there are at most 1000 loaded portfolios - increase the first makevector argument if there are more (!).