Indexes in Cache Objects


I have the following objects

Class A

   Property P1 As B

   Property P2 As %String

   Property P3 As %String

Class B

   Property P1 As %String

Can I create an index in Class A based on P1.P1.  Basically I want an index of class A by property P1 in class B

I tried creating the following but got a compile error

Index I1 On P1.P1



You can create computed property and index it.

Class A {

Property P1 As B;

Property P1P1 As %String [ SqlComputeCode = {set {*} = ##class(B).P1GetStored({P1})}, SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE) ];

Index I1 On P1P1;