Data groups are the core of fDocs. They define and organise the data required for inclusion in outputs. There are many different types of data group, from SQL queries to web services. You can nest data groups one inside the other, so the inner ones are executed separately for every row in their parents.
The Data Group Window
The Data Group window is where all the information about an individual data group can be found.
The sections down the left hand side follow the natural order of the execution of a data group. For example, placeholders can be used to carry information from previous data groups down into this data group, which is fed to the action this data group performed (in the example above, an SQL query), and then data items can be calculated from the results of the action. The results that come back from the data group can be sorted and the fieldnames can be translated, and if the DSD is used to generate outputs using fDocs, additional options are available.
Within the Data Group settings section the name of the data group is specified, and any additional comments can be entered. These comments are visible within fData only, and can be used to describe what the purpose of the data group is for.
If you enter a function here it will be evaluated before the data group is executed and if it returns anything other than “true” the data group will not be executed (and effectively appear to have no records). Not that this is executed for each record in the parent data group, if applicable. See separate documentation for more information on functions.
Most data groups are used to gather data that is available in the template. However, sometimes a data group is only present to gather data to be passed on to a later data group (e.g. a reference value).
In this case, uncheck this box in order to remove the data group’s values from those available in the template design or panels. The data group will still be executed but the values may not be inserted into the output.
Data groups can be nested within each other, so that as each row is processed in the parent data group, the child data group is executed.
For example, if the parent data group is a list of clients, the child may open a Microsoft Excel file with further details about the client. As each client is processed, a separate Excel file is opened and made available to the template.
To indicate that a data group is inside another select its parent from the list provided. Only data groups above the current one are offered as a data group’s parent must be executed before itself. If the current data group is the first in the list, this option will not be available.
Relative data groups also use the parent option to indicate to which data group they are relative.
You can safely nest data groups to multiple levels.
Data groups can also be linked together, so that as each row is processed in the main data group, the corresponding row is located in the linked data group. This makes it possible to use a data item in the main data group that accesses a value in the linked data group, from the correct row.
For example, if one data group contains a client name, address, and postcode, and a second group contains a postcode and the details of the parish that postcode is in, the parish details can be linked to the client details. You can then add a data item to the client data group to bring across the corresponding parish.
To set up a join, specify the data group to join to, and the field to join on, and the field from this data group to join from.
Note that the main data group is the one joined to. This is so that many different data groups can be linked to the main data group.