It is not possible in a view to access methods of underlying data sources. The reasoning is simple. Views in the AOT become SQL Server views directly in the database, and SQL Server cannot run X++. Having said that, it is possible to build some quite powerful logic directly onto those views in the form of computed columns. There are good examples of this in the AOT. Check out the views InventTransGrouped, InventTableExpanded, InventSumAggrDeltaView, etc. There you can see complex usage of the SysComputedColumn class to build calculated fields into SQL Server views. It sounds from your description like you probably won't be able to accomplish what your method does using calculated fields. There's no reason to be stuck using a view in your case and suffer not being able to use your display methods. Instead, build a query, which can itself be assigned to the data source of a form, and then allows you to reference the display methods of underlying data sources directly. And then you can build a view on that query, and use that view in cases where you do not need the display methods. Hope this helps.
↧