You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Run-time report product filter problem

Accepted answer
20
Views
9
Comments
edited Feb 11, 2014 3:46PM in Customer Portal 9 comments

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 2013

Code 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; 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!