Astral Reports - Help V5:

Generic Function

The Generic Function has been included to provide access to every field within every table. If your reseller has added additional fields or entirely new tables, Astral Reports For Business Central can report on these fields.

To use the Generic Function, select the Cell that you wish the value to be placed in to, and then select "Insert Generic Function" from either the Ribbon or the Right-Click context menu. This will provide a wizard that will build the initial function.

Astral Reports Generic Function Figure 1.img

Figure 1

Astral Reports Generic Function Figure 2.img

Figure 2

After reading the Table Structure, the wizard provides you with a list of tables. Double-clicking a table will provide you with a list of fields within the table. Select the required field and then click the OK button.

Astral Reports Generic Function Figure 3.img

Figure 3

This then analyses the selected field, and if the field is a FlowField, it will attempt to find out which of the FlowFilters in the table affect the fields calculation.

After the function is built, the standard "Function Argument" form will be displayed:

Astral Reports Generic Function Figure 4.img

Figure 4

This shows the first four parameters as Connection, Company, Table and Field. The parameters after this relate to the Key fields of the table (Key1...Key9), and then Filter Field and Filter Value parameters for the FlowFilters that affect the fields calculation. You will need to understand which fields form the primary key for the table, and you will need to replace the "KEY_FIELD_1?", "KEY_FIELD_2?" placeholders with the cells or values that contain the correct record selection, and the "#FILTER#" placeholders with the filter values required (or leave blank).

As an example, if the table that we select is the Customer table, the primary key for this table contains just one field which is the "No." field. Therefore, to identify the exact record that we want, we need to enter the Customer No. into the Key1 parameter, in the above example 10000.

Also, if the field that we select in the Customer table is the "Profit (LCY)" field, the functionality should identify that the "Global Dimension 1 Code", "Global Dimension 2 Code", "Posting Date" and "Currency Code" FlowFilters affect the calculation of the FlowField.

Astral Reports Generic Function Figure 5.img

Figure 5

Note that for Date Filters, we recommend first using the "DateFilter" function to combine two date fields into a usable Date Filter, and using the Cell result as the value for the parameter.

Astral Reports Generic Function Figure 6.img

Figure 6

Also note that the functionality analyses the data to see which FlowFilters within the table affect the calculation of the selected field. If the field is not used (for example the Global Dimension 2 Code is not recorded against the data that the FlowField sums), the FlowFilter may be excluded. In this scenario, you can manually add the field to the function.

The wizard only reads the table structure the first time the wizard is called. Subsequent uses of the wizard will not reread the database structure again.

If you are unsure of the table structure in terms of primary keys and flowfilters, the following may help you find the information that you are looking for. As an example for finding out the structure of the Customer table: to find the fields that form the primary key.

Search for the Customers list in the top right hand corner.

1) Once open click onto the ’?’ symbol located and then help and support on the dropdown field or alternatively click Ctrl + Shift +F1.

2) Under trouble shooting click onto ‘Inspect Pages and Data’.

3) Identify the fields that have the letters "(PK)" after them. PK stands for Primary Key to find the list of FlowFilters that are available to the table.

Astral Reports Generic Function Figure 7.img

Figure 7