KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Using Filter with a parameter #1136

Open Daniel Amamoo-Otchere opened this topic on on Oct 24 - 5 comments

Daniel Amamoo-Otchere commented on Oct 24

Hello Kool Team,

I have a dataset node which is used to build another dataset node2 with some filters. How do I apply a different paramter using the Filter option only for that dataset.

$node->pipe($this->dataStore("result"));

     $node ->pipe(new Filter([
		['id','in','(:__pid__)']
	  ])) 

Is the way I have defined the filter correct.

The records will come from another datasource not part of the main datasource found in $node

but part of the defaultParams value and bindParamsToInputs functions

KoolReport commented on Oct 24

it is just an array of ids for example

->pipe(new Filter([
    ['id','in',[1,2,3,4]]
]))
Daniel Amamoo-Otchere commented on Oct 25

ok I mean can I use a variable like $id in replacement to the array [1,2,3,4,5]. this is because that is also coming from another parameter

KoolReport commented on Oct 25

Yes, if you have parameter in array form like $ids containing all ids you want to see, you replace with my [1,2,3,4,5] array. The MultiSelect widgets or Select2 multiple can output parameters in array form when your user select a list of ids, you may use them in the view.

Daniel Amamoo-Otchere commented on Oct 25

Still not so sure how to handle this :

Below is the select control. How do I pass it to the "dataStore"=>$this->dataStore("student_trend") below.


<form>	
        <center><b>Performance per class child </b></center>
	          <h5>Select Level:</h5><?php
                        Select::create(array(
                            "name"=>"pStudent",
							"multiple"=>true,
							"dataStore"=>$this->dataStore("ds_students"),
                             "dataBind"=>array(
                                "text"=>"name_string",
                                "value"=>"students_id",
                        )));
                        ?>
			</form>		
   <?php
             ColumnChart::create(array(
         	"options"=>array(
					    "title"=> 'Performance Charts',
						"width"=> '100%',
						"height"=> '100%',
						"legend"=>array("position"=> "right"),
						),
						  "dataStore"=>$this->dataStore("student_trend")->FILTER("students_id","IN ",),
            ));  
	
KoolReport commented on Oct 25

You should use the Select2, this allow multiple selection, the Select only allow single selection. So if you have a parameter "pStudent" that binds to your "pStudent" Select2 multiple. You will do this:

->pipe(new Filter([
    ['id','in',$this->params["pStudent"]]
]))

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

Inputs