KoolReport's Forum

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

Get node results count after filter process #2321

Closed Ron opened this topic on on Sep 4, 2021 - 1 comments

Ron commented on Sep 4, 2021

I run the following Filter process in a forEach loop. I want to tell what is the node count before I continue to the end of the loop. for example

$node1->pipe( new Filter( array (
    array("teacher_id", "=", $teacher['id']),
    "or",
    array("teacher_id","findInSet",$teacher['id']),
)))
if ($node1->count()....)
Sebastian Morales commented on Sep 6, 2021

In the report's setup, pipes are only setup but data hasn't passed through them yet. Normally data is processed only when $report->run() is called. In your case you must force data to be sent right at once with method requestDataSending() to count data rows like this:

$node1->pipe(new Filter(...))
->pipe($this->dataStore("myds"))
->requestDataSending();

if ($this->dataStore("myds")->countData() > 0) {...}

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
None yet

None