Pass Filters to the HTML Page for Embedded Oracle Analytics Content

You can pass numeric and list filters to the HTML page where you're embedding Oracle Analytics content. You can filter any type of data with these filter types.

The filters payload is a Javascript array containing one filter Javascript object per array item.

In this example, all instances of project refer to workbook. Rendering a workbook while applying filters looks like this:

<oracle-dv project-path="{{projectPath}}" filters="{{filters}}">
</oracle-dv>
 
<script> 
requirejs(['knockout', 'ojs/ojcore', 'ojs/ojknockout', 'ojs/ojcomposite', 'jet-composites/oracle-dv/loader'], function(ko) {
   function MyProject() {
      var self = this;
      self.projectPath =  ko.observable("/users/weblogic/EmbeddingStory");
      self.filters = ko.observableArray([{
         "sColFormula": "\"A - Sample Sales\".\"Products\".\"P2  Product Type\"",
         "sColName": "P2  Product Type",
         "sOperator": "in", /* One of in, notIn, between, less, lessOrEqual, greater, greaterOrEqual */
         "isNumericCol": false,
         "bIsDoubleColumn": false,
         "aCodeValues": [],
         "aDisplayValues": ['Audio', 'Camera', 'LCD']
      },{
         "sColFormula": "\"A - Sample Sales\".\"Base Facts\".\"1- Revenue\"",
         "sColName": "Rev",
         "sOperator": "between", /* One of in, notIn, between, less, lessOrEqual, greater, greaterOrEqual */
         "isNumericCol": true,
         "bIsDoubleColumn": false,
         "aCodeValues": [],
         "aDisplayValues": [0, 2400000] /* Because the operator is "between", this results in values between 0 and 2400000 *
/
  }]);
}
   ko.applyBindings(MyProject);
});
</script>
Supported attributes — Each filter object within the filters payload must contain the following attributes:
  • sColFormula: Specifies the three-part formula of the column to filter. The column formula must include three parts.

    If you're unsure of the formula, create a workbook that uses that column, and then in the Visualize tab, click the workbook's Menu and then click Developer. In the Developer page, click the JSON tab to view the column's expression. For example, sColFormula": "\"A - Sample Sales\".\"Base Facts\".\"1- Revenue\"" .

    If the Developer option isn't displayed in the workbook's Menu, then you need to enable it. See Enable Oracle Analytics Developer Options.

  • sColName: (Required) Specifies a unique name for this column.

  • sOperator: Use in, notIn, between, less, lessOrEqual, greater, or greaterOrEqual.
    • in and notIn - Apply to list filters.
    • between, less, lessOrEqual, greater, and greaterOrEqual - Apply to numeric filters.
  • isNumericCol: Specifies if the filter is numeric or list. Value should be true or false.

  • isDateCol: (Required) Indicates whether the column is a date column. Value should be true or false. Use true if the column is a date, but not for year, month, quarter, and so on. If set to true, then specify date or dates in the aDisplayValues attribute.
  • bIsDoubleColumn: Specifies if the column has double column values behind the display values. Value should be true or false.

  • aCodeValues: When bIsDoubleColumn is true, this array is used.

  • bHonorEmptyFilter: (Optional) Indicates whether an empty filter is honored (for example, empty aCodeValues/aDisplayValues based on the bIsDoubleColumn flag). This attribute applies to all column filters: list filters, number range filters, and date range filters. Value should be true or false.
    • If set to true and the user passes empty aCodeValues/aDisplayValues, then all values are part of the filter.
    • If set to false and user passes empty aCodeValues/aDisplayValues, then the attribute won't be applied and there is no change in filter values.
    • If this attribute isn't present, then the default value is false.
  • aDisplayValues: When bIsDoubleColumn is false, then this array is used to filter and to display values within the user interface.

    When bIsDoubleColumn is true, then the values in this array are used for display in the user interface while the values in aCodeValues are used for filtering. When bIsDoubleColumn is true, there must be the same number of entries in this array as there are in the aCodeValues array and the values must line up. For example, suppose aCodeValues has two values 1 and 2, then aDisplayValues must have two values a and b, where 1 is the code value for a, and 2 is the code value for b.

    If isDateCol attribute is set to true, then specify the aDisplayValues array with dates. If either no time zone in the time stamp or no time stamp is provided, then time is set with the local time zone. Use any of the following formats:

    • mm/dd/yyyy (For example, 12/31/2011.)
    • yyyy-mm-dd (For example, 2011-12-31.)
    • yyyy/mm/dd (For example, 2011/12/31.)
    • mm/dd/yyyy or yyyy/mm/dd, hh:mm:ss (For example, 12/31/2011 or 2011/12/31, 23:23:00.)

      Note: Use a 24 hour format. You can use a space as the separator.

    • mm/dd/yyyy or yyyy/mm/dd, hh:mm:ss AM/PM (For example, 12/31/2011 or 2011/12/31, 11:23:00 PM.)

      Note: Use a 12 hour format. You can use a space as the separator.

    • <3 letter month name> dd yyyy (For example, Mar 25 2015.)
    • dd <3 letter month name> yyyy (For example, 25 Mar 2015.)
    • Fri Sep 30 2011 05:30:00 GMT+0530 (India Standard Time)
    • ISO Date Format - 2011-10-05T14:48:00.000Z