Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
We are sorry that we did not have the left join process. What we do have is the leftJoin() method in DataStore. May be you could left join two datastores at the end. I will mark this thread as [suggestion] for further enhancement.
Do you have something like CalculatedColumn
for DataStore?
The problem is that I need to do some calculations that used data from both tables and put the result in the new column.
If I do join on the process level (before i put data to any DataStore) - i can do it, but how to do the same with DataStore?
I think i can use process()
for that and use CalculatedColumn but can i use function($data){...}
for calculation?
You use process() method of DataStore.
Something went wrong :-(
I tried to update my report file using left join etc but get the empty table
What i have
1. Two DataStores dataStore('stock')
and dataStore('from_csv')
$this->src('quinos')
->query($query)
->params($query_params)
->saveTo($fromsql)
->pipe($this->dataStore('stock'));
and
$this->src('fact')
->saveTo($fromcsv)
->pipe($this->dataStore('from_csv'));
$tmp_store = $this->dataStore('stock')->leftJoin($this->dataStore('from_csv'),array(
"name" => "name"
));
$tmp_store->process (new CalculatedColumn(array(
"diff" => function($data){
return $data["fact"]-$data["balance"];
},
)))
->pipe($this->dataStore("joined_stock"));
If i use the same CalculationColumn code after using $join = new Join($fromsql, $fromcsv, array("name" => "name"));
everything is ok excepting that i need the left join
We have the join() in DataStore as well that you may use to join two datastore on keys.
Hi guys, I am trying to do LeftJoin of two data sets and I am getting error Message: Invalid argument supplied for foreach()
My code looks like this:
// 1st
$stanjeRobe = $this->src('automaker')
->query($prodaja_radnje['priprema'])
->params(array(
":korisnik"=>$dodDobavljac
)) // ;
->pipe($this->dataStore("stanjeRobe"));
// 2nd store
$prodajaRadnje = $this->src('automaker')
->query($prodaja_radnje['sve'])
->params(array(
":korisnik"=>$dodDobavljac,
":start"=>$this->params["dateRange"][0],
":end"=>$this->params["dateRange"][1],
))//;
->pipe($this->dataStore("prometRobe"));
$new_store = $this->dataStore('prometRobe')->leftJoin($this->dataStore('stanjeRobe'),array(
"SifraMat"=>"SifraMat"
));
I have tried this way as well, same thig but a bit different:
// ## 1st
$this->src('automaker')
->query($prodaja_radnje['priprema'])
->params(array(
":korisnik"=>$dodDobavljac
))
->pipe($this->dataStore("stanjeRobe"));
// ## 2nd
$this->src('automaker')
->query($prodaja_radnje['sve'])
->params(array(
":korisnik"=>$dodDobavljac,
":start"=>$this->params["dateRange"][0],
":end"=>$this->params["dateRange"][1],
))
->pipe($this->dataStore("prodajaRadnje"));
// this throws an error: Message: Invalid argument supplied for foreach()
$new_store = $this->dataStore('prodajaRadnje')->leftJoin($this->dataStore('stanjeRobe'),array(
"SifraMat"=>"SifraMat"
));
I am using just Join as below and works fine but I need left join to have correct data.
$join = new Join($stanjeRobe,$prodajaRadnje,array(
"SifraMat"=>"SifraMat","BrojSklad"=>"BrojSklad"
));
Is there something different in documentation (https://www.koolreport.com/docs/datastore/overview/#join-methods-leftjoin) that I am missing or I did not use it properly here.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo