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

Add Filter to Report Using Hooks

Accepted answer
39
Views
1
Comments
edited May 29, 2015 11:40AM in Reporting & Analytics for B2C Service 1 comment

Content

I find it odd that there isn't much documentation on how to achieve the same (or maybe my searching skills aren't that good) but searching through the discussions I was able to build some lines of code.



The Scenario



Using a pre_report_get, I want to filter a report (ID 176) on the Answer.Summary column. Here is what I've gathered so far from this thread:




<br /> // hooks.php<br /> $rnHooks[&#39;pre_report_get&#39;][] = array(<br /> &#39;class&#39; => &#39;filter_report&#39;,<br /> &#39;function&#39; => &#39;report_run&#39;,<br /> &#39;filepath&#39; => &#39;&#39;<br /> );<br /> <br /> // filter_report Class<br /> function report_run($hookData)<br /> {<br /> if($hookData[&#39;data&#39;][&#39;reportId&#39;] == &#39;176&#39;) <br /> {<br /> $hookData[&#39;data&#39;][&#39;filters&#39;][&#39;custom1&#39;]->filters->fltr_id = answers.summary; <br /> $hookData[&#39;data&#39;][&#39;filters&#39;][&#39;custom1&#39;]->filters->oper_id =7; <br /> $hookData[&#39;data&#39;][&#39;filters&#39;][&#39;custom1&#39;]->filters->data = &#39;Garbage&#39;; <br /> $hookData[&#39;data&#39;][&#39;filters&#39;][&#39;custom1&#39;]->filters->rnSearchType = &#39;custom&#39;;<br />

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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