Run-time report product filter problem
Content
Hey, I got a widget that displays answers from a custom report. However I want it to filter by a product so I've added a run-time filter to it named "Product" with the "Equals" operator.
Running the getRuntimeFilters on the report outputs the following array:
array(1) { [0]=> array(11) {
["fltr_id"]=> int(3)
["name"]=> string(7) "Product"
["type"]=> int(1)
["oper_id"]=> int(1)
["data_type"]=> int(1)
["optlist_id"]=> int(9)
["expression1"]=> string(26) "answers.map_prod_hierarchy"
["attributes"]=> int(273)
["default_value"]=> string(5) "~any~"
["prompt"]=> string(7) "Product"
["required"]=> int(0) } }
I've popped the filter code below:
Version
August 2013Code Snippet
$getFilter = $this->CI->model('Report')->getFilterByName($this->data['attrs']['report_id'], "Product"); $productFilter = $getFilter->result; $filters['product']->filters->rnSearchType = 'custom'; $filters['product']->filters->fltr_id = $productFilter['fltr_id']; $filters['product']->filters->oper_id = $productFilter['oper_id']; $filters['product']->filters->report_def = $productFilter['report_def']; $filters['product']->filters->name = $productFilter['name']; $filters['product']->filters->data = $this->data['attrs']['product_id']; $reportToken = createToken($this->data['attrs']['report_id']); $resultsData = $this->CI->model('Report')->getDataHTML($this->data['attrs']['report_id'], $reportToken, $filters, $format); $results = $resultsData->result;
0