KoolReport's Forum

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

Export To XML with multidimensional Array #1857

Open EmaPromenna opened this topic on on Jan 21, 2021 - 7 comments

EmaPromenna commented on Jan 21, 2021

We are using the getXml function for export the XML file.While Using the below code with multidimensional Array, getting the error Array To String conversion and file is not getting exported

Code :

$report = new MyReport;
echo $report->run()->getXml();

Sample Array

Array
(
    [0] => Array
        (
            [id] => 89
            [full_company_name] => dell
            [abbreviated_company_name] => ABC Testing
            [group_name] => 
            [full_address] => Add 4
            [building_name] => test
            [json_data] => Array
                (
                    [0] => Array
                        (
                            [client_id] => 7562
                            [test_data] => Array
                                (
                                    [0] => Array
                                        (
                                            [TEST] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [cuum] => 40 
                                                        )                                                 
                                        )

                                )
                              )

                )

        )

)
David Winterburn commented on Jan 22, 2021

Please post your report's setup for us to see. Thanks!

EmaPromenna commented on Jan 22, 2021

Please find attached snippet of code which we have tried.

]

David Winterburn commented on Jan 22, 2021

Please replace your "json_data" column's value with a string to see if there's any error when exporting to xml?

EmaPromenna commented on Jan 22, 2021

If we are using the string in the "json_data" it works as expected. But we have the requirement with the multidimensional array as we have given you in the previous comment.

Also I have attached error screenshot while using the multidimensional array.

David Winterburn commented on Jan 22, 2021

I see your point. We have a defined structure for KoolReport and its data. That's why we could export them to xml. How do you expect your json data to be formatted in xml? Please give a specifict example so we have an idea. Thanks!

EmaPromenna commented on Jan 22, 2021

Please check the below screenshot,For formatted XML as the the above arary

David Winterburn commented on Jan 26, 2021

Hi,

Thanks for your feedback! We will discuss with the dev team about this situation with array/json data in datastore and how to export them to xml and get back to you. 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
help needed

None