Using a report setup table
Sometimes, when you create a report, you also create a request page, so that the user can set up the report layout according to options they specify in the Options tab of the request page. Similarly, you can also create a report setup table that contains information about the report layout. You can then create a page so that users can change the fields in this table, because the information is stored in a table. Then, when you create a report, you can query this table to fetch the information that you will use in the report layout.
There's actually already an example of this principle used in document reports. You might remember the company logo that can be hidden or displayed on the left, middle or top of a document. The field is stored in the Sales
and Receivables Setup
table and is named Logo Position on Documents
. The logo is placed in the dataset and displayed on the left, middle or right of the report header depending on its value, in the OnPreReport
trigger...