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>
-
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
: Usein
,notIn
,between
,less
,lessOrEqual
,greater
, orgreaterOrEqual
.in
andnotIn
- Apply to list filters.between
,less
,lessOrEqual
,greater
, andgreaterOrEqual
- Apply to numeric filters.
-
isNumericCol
: Specifies if the filter is numeric or list. Value should betrue
orfalse
. isDateCol
: (Required) Indicates whether the column is a date column. Value should betrue
orfalse
. Usetrue
if the column is a date, but not for year, month, quarter, and so on. If set totrue
, then specify date or dates in theaDisplayValues
attribute.-
bIsDoubleColumn
: Specifies if the column has double column values behind the display values. Value should betrue
orfalse
. -
aCodeValues
: WhenbIsDoubleColumn
istrue
, this array is used. bHonorEmptyFilter
: (Optional) Indicates whether an empty filter is honored (for example, emptyaCodeValues/aDisplayValues
based on thebIsDoubleColumn
flag). This attribute applies to all column filters: list filters, number range filters, and date range filters. Value should betrue
orfalse
.- If set to
true
and the user passes emptyaCodeValues/aDisplayValues
, then all values are part of the filter. - If set to
false
and user passes emptyaCodeValues/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
.
- If set to
-
aDisplayValues
: WhenbIsDoubleColumn
isfalse
, then this array is used to filter and to display values within the user interface.When
bIsDoubleColumn
istrue
, then the values in this array are used for display in the user interface while the values inaCodeValues
are used for filtering. WhenbIsDoubleColumn
istrue
, there must be the same number of entries in this array as there are in theaCodeValues
array and the values must line up. For example, supposeaCodeValues
has two values1
and2
, thenaDisplayValues
must have two valuesa
andb
, where1
is the code value fora
, and2
is the code value forb
.If
isDateCol
attribute is set totrue
, then specify theaDisplayValues
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