Below is my setup of my initial table in MyReport
function setup()
{
$this->src('substantiator')
->query("SELECT bus_comp FROM business_components WHERE campaign='Apple' AND email='richb201@gmail.com'")
->pipe(new ColumnRename(array(
"bus_comp"=>"Business Component")))
->pipe($this->dataStore("business_components"));
}
and in MyReports.view I have
Table::create(array(
"dataStore"=>$this->dataStore("business_components"),
"class"=>array(
"table"=>"table table-hover"
)
));
This generates works fine.
Next, on the same report, further down the report, I want to use a different table completely. For example
$this->src('substantiator')
->query("SELECT name FROM employees WHERE campaign='Apple' AND email='richb201@gmail.com'")
->pipe(new ColumnRename(array(
"name"=>"employee name")))
->pipe($this->dataStore("employees"));
How do I do this? Do you have any example of using two different table on a single report , not with a join?
A different question:
In the above examples I hard coded in the 'campaign' and the 'email'. In reality I need to use this:
$this->src('substantiator')
->query("SELECT bus_comp FROM business_components WHERE campaign=$this->$_SESSION['campaign'] AND email='richb201@gmail.com'")
But I get an error:
Message: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Please tell me how to use a session variable in the query.