Switch to: V12V11V10V9V8V7V6V5

Report Editor - Recursive Reports

Displaying hierarchical data is a common use for recursive hierarchies, such as displaying employees in an organizational chart. Starting with Valentina Studio Pro 10.5.2, it is possible to set a report as its subreport, forming a recursive report. This feature is available with all supported databases.

This can be used to represent data that has a hierarchical structure – the relation between rows in a table is defined by a reference id to the record id (manager to employee, or company to division, etc), for example:

employee empno manager
KING 7839 NULL
JONES 7566 7839
SCOTT 7788 7566
ADAMS 7876 7788
FORD 7902 7566
SMITH 7369 7902
BLAKE 7698 7839
ALLEN 7499 7698
WARD 7521 7698
MARTIN 7654 7698
TURNER 7844 7698
JAMES 7900 7698
CLARK 7782 7839
MILLER 7934 7782

The query for the main report returns all root managers:

SELECT * FROM employees WHERE manager ISNULL

The query for the subreport will be recursively called to return employees of the specific manager on each step:

SELECT * FROM employees WHERE manager = $P(pManager)

The layout of the recursive subreport:

Preview of the report with hierarchical data: