Ad Hoc Layouts

The ad hoc layout is the basis for any report created with Ad Hoc Reporting. It defines the elements, which can be modified by the user, their formatting and the design elements of a report. Layouts may as well use static elements and fields which are fixed in quantity and / or appearance.

The types of elements which are present in an ad hoc layout defines which pages will be available on the GUI to modify these elements. For instance, if there is at least one group in a layout, the group page will be available for this layout.

This chapter describes how set up an ad hoc layout using the i-net Designer.

Types of Ad Hoc Layouts

There are two types of ad hoc layouts available:

  • Real layouts: Defines the position and appearance of report elements but don't have a data source yet. These layouts require the user to set at least a data source and configure one of the primary report elements (columns, chart or cross-tab) to receive a suitable result. This type of layout should be preferred when running an Ad Hoc Reporting.
  • Ready reports: These reports are basically normal reports created for i-net Clear Reports. These types of layout can be executed right away without any further modification. The user will be able to apply minor adjustments to the elements of this report like adjusting the filter.

How to create an Ad Hoc Layout

The condition for an i-net Clear Reports report to be an real ad hoc layout is the usage of the LayoutDatasource. This data source will be created by the installation process. It does not refer to any database. Instead it provides template fields which will be replaced by real database fields at the time the ad hoc report is executed.

So to create a basic layout, simply start the i-net Designer, create a blank report and set the LayoutDatasource as it's only data source.

Please note: if there is any other data source than the LayoutDatasource, the report will be regarded as ready report.

Columns

To create a table style layout, at least one field has to be added to the details section of the layout. These fields will later on be replaced by the fields chosen by the user. The value type of the LayoutDatasource field added to the details section is irrelevant.

There are three types of column layouts available, depending on the page layout and the number of fields added to the details section.

Variable columns

To allow a variable number of fields per table row in an ad hoc report, add exactly one field to the details section of the layout. This field will be copied at runtime for any field the user adds to his ad hoc report.

The distance between this field and the left border of the details section will be the left gap of all columns of the resulting ad hoc report.

If you add a vertical line to the right of the column, the distance between the right edge of the field and this line will be the right gap of all columns of the resulting ad hoc report.

Figure 1: Variable Columns Layout

Any other design element like a horizontal line or a box will not be copied or modified. It will appear in the resulting report at the designed position.

If a user now adds for instance three fields to his ad hoc report, the rendering result will have three columns, each one with the designed gaps and separator lines between them.

Figure 2: Variable Columns Layout, render example

As you can see, the width of the field itself is scaled to fill up the remaining space between the gaps. So the width of the designed field is not relevant for the result, but there is a minimum width for all types of fields.

To use the automatic column name, place a text field with exactly the name of the data field in the section above the detail area. This is what the i-net Designer will do automatically by the way. This field will be replaced by the name of the column at runtime. In our example the bold text field with the content 'column_integer' is replaced with the column names 'ProductName', 'Price' and 'Size'.

Fixed Columns

If you add more than one field to the details section of a report, the ad hoc report uses fixed columns.

Figure 3: Fixed Columns Layout

Fixed column layouts do not scale or copy fields horizontally. Instead the layout will be used as is.

Figure 4: Fixed Columns Layout, render example

If the user selects less fields than defined by the layout, the remaining columns will be left empty. If the user selects more fields than defined by the layout, the details section will be copied vertically to place all columns.

Figure 5: Fixed Columns Layout, render example with too many columns

Please note that the header is not copied. So if the user selects more columns than defined by the layout, the table header and the cell contents wont be consistent anymore.

Mailing Label

The mailing label mode is used if the page layout is set to multi-column or label. In that case the available space for the layout is limited in width and height.

Mailing label allows fixed and variable columns as well, but the fields will be placed by another algorithm at runtime.

Please note that there is no automatic column name for mailing labels.

  • Variable Columns: For mailing labels the columns will be copied vertically instead of horizontally.
Figure 6: Mailing Label Layout

If there are to many columns to fit into the height of the label, the label will be divided horizontally as well to create several columns and rows.

Figure 7: Mailing Label Layout, render example
  • Fixed Columns: The fixed columns layout algorithm of mailing labels works like the normal one. It only duplicates the detail area vertically which will usually fill up the complete label by a few fields.

Any field that overflows the height of the mailing label will be invisible.

Groups

Grouping will be available to the user, if an ad hoc report contains at least one group. In case of a real layout the user can add or remove groups, in case of a ready report the user will only be able to change the defined groups.

What happens when the user adds a group?

If groups are added to an ad hoc report, first of all the existing groups of the ad hoc layout will be filled. So if you've designed three groups and the users adds three groups the result will display the three designed groups and their layout.

If the users adds more groups than available in the ad hoc layout, the last group header and footer will be copied including it's summary fields and name elements.

What happens if a group is removed or left out?

If a group defined by the ad hoc layout is not filled by the user, it's contents will be moved into the next group header and footer.

If there is no group filled at all, the content of the designed group will be moved into the page header and page footer depending on whether the group has set the flag 'Repeat group header in each page'.

This feature can be used to create grouped chart reports by placing the chart in the group footer of the first group. If there is no group at all, the chart will be moved into the page header and display all datasets.

Please note: Summary fields and group name fields are not moved since they are bound to a certain group. They will be removed if their group was not set/filled by the user. As a further notice, charts and cross-tab of the group footer will be moved into the page header, since they cannot be placed in the page footer.

Sums

To enable the usage of sums for the user, simply put a sum field into any section except the 'Detail Area'. The settings of this sum field will have no effect since they are overwritten by the user's choices.

At runtime the sum fields will be automatically aligned to the columns they sum up. They'll keep their size and vertical offset as well as the formatting.

The section a sum field is placed into defines the grouping and running total type of this field.

  • if placed in a group header or footer, the sum will be grouped
  • if placed in the page footer, the sum will be a running total
  • if placed in the report header or footer, the sum field will sum up all records

Placing a sum field in several sections will cause Ad Hoc Reporting to add similar sum to all of sections but with different group and running total types.

As an example, placing a sum in the group and report footer will create a grouped sum and a total for all columns selected by the user.

Figure 8: Sum Fields – layout and rendering result

Adding several sum fields to the same section in a real layout will have no effect. Ad Hoc Reporting will only use the first sum field in a section as a template.

In a final report, sum fields can only be modified by the user. Their position, number and appearance is fixed.

Formatting

The formatting of a field in an rendered report depends on three sources (in ascending priority):

  • Ad Hoc Layout: In an ad hoc layout you are free to set any property of a field element as normal. The only limitation is the type of the field. Number properties for instance can only be set on number fields.
  • Ad Hoc Dataview: Ad hoc dataviews are restricted to properties which are related to the type of data represented by a field. Pure styling properties cannot be set in an ad hoc dataview. So number properties are allowed for instance while the border or background color can only be set in the ad hoc layout. In general, the design of the rendered report will never be influenced by the chosen data source.
  • Field format set by the user: The user is allowed to set the number or date/time format of any column. This setting has highest priority at it is set to any non-default value.

Property formulas are allowed in both the ad hoc layout and ad hoc dataviews. But keep in mind, that the type of the field at runtime may be different to the type of field used in the ad hoc layout. So, if you use 'currentFieldValue' in a property formula, the formula is only valid if the types match otherwise it will have no effect.

Chart and Crosstab

Ad hoc reporting supports to modify one chart and crosstab per ad hoc layout. If there are more charts or crosstabs in an ad hoc layout, they will not be modified. In a ready report the surplus charts / crosstabs will be rendered as they were designed. In a real layout they will be invisible since insufficiently configured charts and crosstabs are not displayed.

Every feature of charts and crosstabs can be used except the combined chart.

Special Fields

Every special field can be added to and ad hoc layout. The content of the following fields can be modified by the user:

  • Title
  • Author
  • Comment

The following fields can be disabled by the user if present in the ad hoc layout:

  • Print date
  • Print time
  • Page number
  • Record Number

Please note, that special fields, which require information about the total number of pages of the rendered report will cause the whole report to be rendered before the first page is displayed. If these fields are not present the renderer will display the first page of a rendered report to the user as soon as it is available.

So, using special fields like 'Page number' may decrease the user experience of your ad hoc layout.