Writing C/AL code in a report
The report designed in the previous example retrieved data from a database table and presented the result without extra manipulation. It is as simple as that, when the data the users require does not have to be transformed.
Getting ready
The file name in the source files is REP50020_SalesByCustomerItem.txt.
How to do it...
Now we will create a report that collects aggregated data into a temporary record to calculate values that cannot be retrieved from a table directly. Aggregated values are computed by C/AL code executed in report triggers.
Create a report object in NAV Object Designer.
Declare a global variable
TempValueEntryofRecordtype andSubType = Value Entry. This is a temporary buffer where aggregated report amounts will be stored. Open its properties and setTemporarytoYes.Create a data item with the
Customertable as the data source.Under the
Customerdata item, add another one and set the data source toItem Ledger Entry. Open data item properties...