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.inandnotIn- Apply to list filters.between,less,lessOrEqual,greater, andgreaterOrEqual- Apply to numeric filters.
-
isNumericCol: Specifies if the filter is numeric or list. Value should betrueorfalse. isDateCol: (Required) Indicates whether the column is a date column. Value should betrueorfalse. Usetrueif the column is a date, but not for year, month, quarter, and so on. If set totrue, then specify date or dates in theaDisplayValuesattribute.-
bIsDoubleColumn: Specifies if the column has double column values behind the display values. Value should betrueorfalse. -
aCodeValues: WhenbIsDoubleColumnistrue, this array is used. bHonorEmptyFilter: (Optional) Indicates whether an empty filter is honored (for example, emptyaCodeValues/aDisplayValuesbased on thebIsDoubleColumnflag). This attribute applies to all column filters: list filters, number range filters, and date range filters. Value should betrueorfalse.- If set to
trueand the user passes emptyaCodeValues/aDisplayValues, then all values are part of the filter. - If set to
falseand 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: WhenbIsDoubleColumnisfalse, then this array is used to filter and to display values within the user interface.When
bIsDoubleColumnistrue, then the values in this array are used for display in the user interface while the values inaCodeValuesare used for filtering. WhenbIsDoubleColumnistrue, there must be the same number of entries in this array as there are in theaCodeValuesarray and the values must line up. For example, supposeaCodeValueshas two values1and2, thenaDisplayValuesmust have two valuesaandb, where1is the code value fora, and2is the code value forb.If
isDateColattribute is set totrue, then specify theaDisplayValuesarray 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