KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Why is this filter not working? #2134

Open Richb201 opened this topic on on Jun 8, 2021 - 3 comments

Richb201 commented on Jun 8, 2021
Table::create(array(
    "dataStore"=>$this->dataStore("ius")
        ->pipe(new Filter(array(
        array("IUS","=","1"),
        array("taxyear","=",$_SESSION['last_TY'])
        ))),
    "columns"=>array(
        "IUS",
        "bus_comp",
        "dual_use_text",
        "innovative_text",
        "sig_eco_text"),

    "class"=>array(
        "table"=>"table table-hover"
    )
));
  }

I get "No data available in table". Those two filters are being 'anded", right?

Sebastian Morales commented on Jun 9, 2021

You can't pipe a datastore in a widget like that. Do not invent your way. Either pipe filter in your report's setup or in a function in a widget's `dataSource, or filter a datastore like this:

    //MyReport.view.php
    $filteredDatastore = $this->dataStore("ius")
    ->filter("IUS","=","1")
    ->filter("taxyear","=",$_SESSION['last_TY']);

Then use $filteredDatastore for your widget. Rgds,

KoolReport commented on Jun 9, 2021
Richb201 commented on Jun 9, 2021

I got it to work by using this in the setup.

    $sql="
    SELECT *
    FROM business_components
    WHERE email='$email' AND campaign='$campaign' AND IUS='1'
    ";
    $this->src('substantiator')
        ->query($sql)
        ->pipe($this->dataStore("ius"))  ;

Thx

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

None