KoolReport's Forum

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

Change data in one column in datasource1 to data from the column from the datasource2 #2839

Open Eugene opened this topic on on Oct 3, 2022 - 4 comments

Eugene commented on Oct 3, 2022

Hi, I have 2 dataStore for example

DataStore 1:

id | value1 | value2

DataStore 2:

id | value2

I wish to change the corresponding data in DataStore 1 for column value 2 to values 2 from the DataStore 2

What is the best way to do it?

Sebastian Morales commented on Oct 4, 2022

I think you could try DataStore's join method:

https://www.koolreport.com/docs/datastore/overview/#join-methods

Then add some processes such as Map, CalculatedColumn, etc to modify column 2's value or create a new column:

https://www.koolreport.com/docs/datastore/overview/#other-methods-process

Let us know if this works for you. Tks,

Eugene commented on Oct 4, 2022

Thank you I will try...

Eugene commented on Oct 5, 2022

One more question if I have a datastore in the variable $myds how canget access to it using $this->dataStore('my_datastore')

Maybe it is a stupid question but after some iterations in the myreport.php file, I have my result in the variable so I want to get access to it in myreport.view.php.

Sebastian Morales commented on Oct 6, 2022

In your report setup you can set the variable to be a property of the report itself then access the property in report view:

//MyReport.php
function setup() {
    ...
    $this->var = $var; //$this is the report object
}

//MyReport.view.php
var_dump($this->var);

Let us know if we understand your question correctly. Rgds,

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

None