Skip to content

Commit

Permalink
24285, add filters to drill down
Browse files Browse the repository at this point in the history
  • Loading branch information
jgunderson committed Aug 8, 2014
1 parent 2a59629 commit 763e498
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
3 changes: 2 additions & 1 deletion source/bi_open/client/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 += ")";
Expand Down
7 changes: 6 additions & 1 deletion source/bi_open/client/widgets/bi_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
18 changes: 13 additions & 5 deletions source/bi_open/client/widgets/bi_funnel_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [],
Expand All @@ -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

Expand All @@ -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
});
Expand Down
15 changes: 12 additions & 3 deletions source/bi_open/client/widgets/bi_timeseries_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [],
Expand All @@ -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

Expand All @@ -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
});
Expand Down

0 comments on commit 763e498

Please sign in to comment.