Labels

Tuesday, June 21, 2011

Parameter Setup

Usually I face a problem, that some constants should be stored in database. For example, complex report should be run and a hundreds of filters should be setted up. When running report user should have friendly interface with the number of parameters, that he can change (for example, date range), other filters should be not visible for him, but available for support. That's why I've created special table with simple structure:
1 Object Type      Option
2 Object           Integer
3 Parameter ID     Code[30]
4 Value            Text [250]  

Object ID field is related to Object table.
This flexible table allows not only setup parameters for reports, but for dataports and forms, too.

Also, the benefit is that it is not neccessary to add fields in standard Setup tables - less standard database modification.

In the conclusion let me bring a code for reading the parameter from this table, it is very simple:
ReportParameterSetup.GET(ReportParameterSetup."Object Type"::Report, 50163, 'CurrencyGUID');
CurrencyGUID := ReportParameterSetup.Value; 

No comments: