From 763e498062f950e27ad151f586f16dc84612bb6d Mon Sep 17 00:00:00 2001 From: jgunderson Date: Fri, 8 Aug 2014 11:24:00 -0400 Subject: [PATCH] 24285, add filters to drill down --- source/bi_open/client/core.js | 3 ++- source/bi_open/client/widgets/bi_chart.js | 7 ++++++- .../bi_open/client/widgets/bi_funnel_chart.js | 18 +++++++++++++----- .../client/widgets/bi_timeseries_chart.js | 15 ++++++++++++--- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/source/bi_open/client/core.js b/source/bi_open/client/core.js index 1b577156f..c4213b824 100644 --- a/source/bi_open/client/core.js +++ b/source/bi_open/client/core.js @@ -91,7 +91,8 @@ trailing:true, white:true*/ _.each(filterSet, function (filter, index) { query = index === 0 ? query + " WHERE (" : query; comma = index > 0 ? ", " : ""; - query += comma + filter; + //query += comma + filter; + query += comma + filter.dimension + ".[" + filter.value + "]"; }); if (query.indexOf(" WHERE (") !== -1) { query += ")"; diff --git a/source/bi_open/client/widgets/bi_chart.js b/source/bi_open/client/widgets/bi_chart.js index 26fe8eb86..e61f8c012 100644 --- a/source/bi_open/client/widgets/bi_chart.js +++ b/source/bi_open/client/widgets/bi_chart.js @@ -247,7 +247,12 @@ trailing:true, white:true*/ if (dimensionCode) { comma = that.chartSubTitle.length > 0 ? ", ": ""; that.chartSubTitle += comma + ("_" + parm.attribute).loc() + ":" + parm.value.id; - that.where.push(dimensionCode + ".[" + parm.value.id + "]"); + // notice where clauses only support = + that.where.push( + {attribute: parm.attribute, + dimension: dimensionCode, + operator: "=", + value: parm.value.id}); } }); this.updateQueries(); diff --git a/source/bi_open/client/widgets/bi_funnel_chart.js b/source/bi_open/client/widgets/bi_funnel_chart.js index 382ac3c8b..8dede96e0 100644 --- a/source/bi_open/client/widgets/bi_funnel_chart.js +++ b/source/bi_open/client/widgets/bi_funnel_chart.js @@ -128,6 +128,7 @@ trailing:true, white:true*/ listKind = XV.getList(recordType), year = thisEnyo.getEndDate().getFullYear(), month = thisEnyo.getEndDate().getMonth(), + drillDown = thisEnyo.drillDown, startDate = new Date(), endDate = new Date(), params = [], @@ -141,10 +142,17 @@ trailing:true, white:true*/ startDate.setFullYear(year, month - 11, 1); endDate.setFullYear(year, month + 1, 0); - thisEnyo.drillDown[indexDD].parameters[0].value = startDate; - thisEnyo.drillDown[indexDD].parameters[1].value = endDate; - thisEnyo.drillDown[indexDD].parameters[2].value = startDate; - thisEnyo.drillDown[indexDD].parameters[3].value = endDate; + drillDown[indexDD].parameters[0].value = startDate; + drillDown[indexDD].parameters[1].value = endDate; + drillDown[indexDD].parameters[2].value = startDate; + drillDown[indexDD].parameters[3].value = endDate; + // + // Add where clause filters to parameter values + // + _.each(thisEnyo.where, function (filter) { + var parmItem = {name: filter.attribute, operator: filter.operator, value: filter.value}; + drillDown[indexDD].parameters.push(parmItem); + }); // TODO: the parameter widget sometimes has trouble finding our query requests @@ -154,7 +162,7 @@ trailing:true, white:true*/ list: listKind, searchText: "", callback: callback, - parameterItemValues: thisEnyo.drillDown[indexDD].parameters, + parameterItemValues: drillDown[indexDD].parameters, conditions: [], query: null }); diff --git a/source/bi_open/client/widgets/bi_timeseries_chart.js b/source/bi_open/client/widgets/bi_timeseries_chart.js index c7b82e1a3..57a6fb818 100644 --- a/source/bi_open/client/widgets/bi_timeseries_chart.js +++ b/source/bi_open/client/widgets/bi_timeseries_chart.js @@ -126,6 +126,7 @@ trailing:true, white:true*/ year = Number(figure.cx.substr(0, 4)), month = Number(figure.cx.substr(5)) - 1, measure = figure.key, + parameterItemValues = this.drillDown[0].parameters, startDate = new Date(), endDate = new Date(), params = [], @@ -146,8 +147,15 @@ trailing:true, white:true*/ } startDate.setFullYear(year, month, 1); endDate.setFullYear(year, month + 1, 0); - this.drillDown[0].parameters[0].value = startDate; - this.drillDown[0].parameters[1].value = endDate; + parameterItemValues[0].value = startDate; + parameterItemValues[1].value = endDate; + // + // Add where clause filters to parameter values + // + _.each(this.where, function (filter) { + var parmItem = {name: filter.attribute, operator: filter.operator, value: filter.value}; + parameterItemValues.push(parmItem); + }); // TODO: the parameter widget sometimes has trouble finding our query requests @@ -157,7 +165,8 @@ trailing:true, white:true*/ list: listKind, searchText: "", callback: callback, - parameterItemValues: this.drillDown[0].parameters, + //parameterItemValues: this.drillDown[0].parameters, + parameterItemValues: parameterItemValues, conditions: [], query: null });