AX - Views - using AOT morphx

Views in Ax : are used to get data from database that is stored in the memory on the layer in which view is instantiated.

- are like virtual tables that use fields and rows to represent the data record.

- data in a View is not stored as data base object but is dynamically created when view is accessed.


Where? all the places where tables are used.

                         Forms ; Queries ; Reports ; x++ code 

Why Views?       - Focussed Data (only relevant data by picking the relevant fields)

- Customized Data (a single table view from multiple data sources can be created)

- Performance (becaused view definition is created compiled; and is better than complex query)


Create a View:

AOT > Data Dictionary > Views <right click - new View>


Metadata -   query or data source to get the data. Also called View Query

      ** only single table / view / query / map is added to metadata

- right click Data Source > New Data Source : select the [properties] tables from the list

- or drag and drop the data source (table/view/query/maps)

- or in the property on View node [ Query=queryName ] to add a query

Fields -   has data fields of view Small subset of fields

[properties]: Dynamic=Yes [all fields in data source are visible]

                                  = No [can pick selected fields]

Field Groups - logically group the fields.

Methods - add new or override method on xRecord class


Note: unlike SQL view, AX views are read only.

Note2: View created above will generate view definition and store in database. In the SQL management studio you can the view created in AX View.



 Views vs Queries?

             View can be created for single data source (table/view/query/map), but if you want to work with multiple data source then use Query.

             to take performance advantage of view you can add Query to the metadata so that data can be retreived from multiple data sources             


How to view: Browse like how you browse a table. Right click ViewName >Add-Ins >Table browser