Creating a Report Element

Creates one of the following report elements:
  • FreeCell
  • Section
  • Table (VTable, HTable, XTable, and Form)
Remember You cannot create PageZone elements and charts.
Request

POST <webiURL>/documents/{documentId}/reports/{reportId}/elements

Where:
  • {documentId} is the document identifier retrieved from the list of documents
  • {reportId} is the report identifier retrieved from the list of reports

Request body: the valid definition of an element.

Elements are structured as a tree. There is a relationship of parent element and children. For instance, when you put a cell (ID = 5) into the body page zone (ID = 1), the parent ID of the cell is 1. This mechanism allows to add an element in the report structure with accuracy.

Some settings are common to all types of report elements, while some are only specific. These specific settings are located into content tags. The element is added and an ID attributed to the element.

Response

Response type: application/xml or application/json

The response is a message stating the success or failure of the request.

Example

Cell

POST <webiURL>/documents/127/reports/1/elements

In the request body, you define the cell dimensions, padding and contents.

<element type="Cell">
    <parentId>2</parentId>
    <size minimalWidth="4500" minimalHeight="675" autofitWidth="false" autofitHeight="true"/>
    <padding left="75" right="75" top="75" bottom="75"/>
    <content>
        <expression>
            <formula type="Text" dataType="Numeric">=Sum([Sales revenue])</formula>
        </expression>
    </content>
</element>

Example

Section

POST <webiURL>/documents/127/reports/1/elements

In the request body, you define how duplicate row aggregation is managed and a formula.

<element type="Section">
    <content>
        <parentId>2</parentId>
        <axes duplicateRowAggregation="true">
            <axis role="Row">
                <expressions>
                    <formula dataType="String">=[Year]</formula>
                </expressions>
            </axis>
        </axes>
    </content>
</element>

Example

Table

POST <webiURL>/documents/14695/reports/1/elements

Request body:

<element type="XTable">
    <parentId>2</parentId>
    <content>
        <axes>
            <axis role="Row">
                <expressions>
                    <formula dataType="String">=[Country]</formula>
                    <formula dataType="String">=[Year]</formula>
                </expressions>
            </axis>
            <axis role="Column">
                <expressions>
                    <formula dataType="String">=[Resort]</formula>
                    <formula dataType="String">=[Service]</formula>
                </expressions>
            </axis>
            <axis role="Body">
                 <expressions>
                    <formula dataType="Numeric">=[Number of guests]</formula>
                    <formula dataType="Numeric">=[Revenue]</formula>
                 </expressions>
            </axis>
        </axes>
    </content>
</element>