Adding a Variable

Adds a regular or grouping variable definition to a Web Intelligence document.

Request

POST <webiURL>/documents/{documentId}/variables

Where:

  • {documentId} is the document identifier retrieved from the list of documents

Request body in the case of a regular variable:

<variable qualification="Measure|Attribute|Dimension">  
    <name>
    <definition>

Where:

  • qualification is the type of variable
  • <definition> is the formula used by the variable
Remember The regular variables must adhere to the following rules:
  • The formula must be valid.
  • You can only create a measure, an attribute or a dimension.
  • When you create an attribute, the associated dimension is mandatory.

Request body in the case of a grouping variable:

<variable grouping="true">
    <dimensionId>
    <groups>
        <group>
            <name>
            <values>
                <value>

The name of the variable is computed if not provided by the user or in case of name conflict.

Remember The grouping variables must adhere to the following rules:
  • The grouping attribute must be present and set to true.
  • The <dimensionId> element should point to a valid attribute or dimension.
  • Only one group can have the ungroupedValues attribute. Values assigned to the ungroupedValues group are ignored.
  • A group must have a name and contain at least one value, except the ungroupedValues group.
  • A value can be assigned to only one group and must belong to the parent list of values.
Response

Response type: application/xml or application/json

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

Example

Regular Variable

POST <webiURL>/documents/4326/variables

Request body:

<variable qualification="Measure">  
    <name>new variable</name>
    <definition>=[RevenueThreshold]*[Threshold factor]</definition>  
</variable>

Response:

<success>
    <message>The resource of type 'Variable' with identifier 'LB' has been successfully created.</message>
    <id>LB</id>
</success>

Example

Grouping Variable

POST <webiURL>/documents/6409/variables

Request body:

<variable grouping="true">
    <dimensionId>DP0.DOb9</dimensionId>
    <groups>
        <group>
            <name>From January to April</name>
            <values>
                <value>1</value>
                <value>2</value>
                <value>3</value>
                <value>4</value>
            </values>
        </group>
        <group>
            <name>Summer Holidays</name>
            <values>
                <value>7</value>
                <value>8</value>
            </values>
        </group>
    </groups>
</variable>

Response:

<success>
    <message>The resource of type 'Variable' with identifier 'L3' has been successfully created.</message>
    <id>L3</id>
</success>