Surrogate fields in reports
The feature of surrogate keys that was introduced with AX 2012 is powerful, but at times creates ambiguity on their usage. A surrogate key is a key whose value has no meaning to people. A large number generated by the system, such as Recid
, could be a surrogate key. The goal of this recipe is to clarify and showcase examples that use surrogate keys in possible patterns. This recipe is divided into two sections: the first section will discuss the usage of surrogate keys in a query-based report, followed by the section that details their application in RDP-based reports.
How to do it…
To implement this recipe, we will use the example of student and student marks tables. Create these tables and relate the student marks table to the student table with the surrogate key. For the student table, add Student Id as a replacement key in the table properties.
Create the surrogate key by creating a new relation in the student marks table and then using the option New | Foreign...