KoolReport's Forum

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

How to concatenate in databind function #1715

Open Millie Majithia opened this topic on on Nov 16, 2020 - 2 comments

Millie Majithia commented on Nov 16, 2020

I want to concatenate two database values in the databind array and the conventional "." is not working. <?php

                    Select2::create(array(
                        "name"=>"singleSelect3",
                        "dataStore"=>  $this->dataStore("test"),
                    
                        "dataBind"=>"last_name"."first_name", //HERE IS WHERE I WANT TO 
                        "attributes"=>array(
                            "class"=>"form-control",
                        )
                    ));
                    ?>
Millie Majithia commented on Nov 16, 2020

I would also like to be able to update the second dropdown from the first. How would I do this?

David Winterburn commented on Nov 16, 2020

Hi Millie,

One possible solution is to combine those columns into a new one before saving them to datastore "test", such as this:

    //MyReport.php
    ->pipe(new \koolreport\processes\Map(array(
        "{value}" => function($row) {
            $row["full_name"] = $row["last_name"] . $row["first_name"];
            return $row;
        }
    )))
    ->pipe($this->dataStore("test));

Then in the report's view you could bind Select2 with column "full_name". Hope this helps. Thanks!

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