[]
A template layout can contain multiple bound fields which depend on each other while expansion in the final Excel report.
For example, in the below image, the 'team' and 'name' are two bound fields in the template layout where team is the former cell and name is the latter cell. Now, the 'name' field will depend on the 'team' field to group or filter its values based on the team. Also, the direction of expansion of the 'name' field will be decided by the 'team' field. Here, team is the context cell of name.
When multiple fields bound to a data source are defined in a template layout, a relationship is established between them which is called 'Context' relationship. The former cell is called the context cell of latter cell. Based on this relationship, the data is filtered or grouped while expansion in the final report.
There are two types of context relationships:
Filtering Relationship: The data in the cell is filtered using data of the context cell as the filter condition. For example, in the below image, the data in the 'name' cell is filtered corresponding to the data in its context cell:
Following Relationship: The data in the cell is grouped according to the expansion direction of the data in context cell. For example, in the below image, the data in the 'name' cell is grouped and expanded horizontally depending on its context cell:
The context of a cell is defined using the 'C' property. The data in cells expand vertically or horizontally depending on their context. A cell's context can be set in the below ways:
None: No cell context (C= None)
Custom: The cell context is specified explicitly using 'C' property
Default: If no context is defined in the cell, the default context cell is the adjacent cell on the left with E=V (expanding vertically),or adjacent cell on the top with E= H (expanding horizontally)
For example, in the below image, A1 is the context cell of B1 and expands vertically.
And, A1 is the context cell of A2 and expands horizontally.
The priority order in which context should be applicable on a cell is determined in the following order:
Explicit context > Default Context > Fallback context
Explicit context: The context defined by C property in the cell itself
Default context: If no context is defined in the cell, the default context is given priority
Fallback context: If there is no adjacent cell value on the left or top, the cell looks for a cell with R (Range) property which covers its location, and use it as its context.
The Fallback context can be defined in a cell using the Range property, in case no default or explicit context is defined. The cell that defines the range is followed as a context for other cells to expand.
For example, the below template layout is created to display the sales details for different camera models, which means the data needs to expand with repect to the model of the camera. Then after a break, the sales details need to be displayed for another model of the camera. Instead of adding context to every field, we can define the range R=B11:F16 for Camera model - {{ds.Name (R=B11:F16)}}, stating that the sales details need to expand and group with respect to the camera model.
The above template layout will generate the following Excel report: