Using Mutliple Data Models in Csv Download

Download combined data from multiple data models in a CSV file.

Overview

The issue occurs because ChronoForms does not support merging multiple data model arrays directly in the CSV data provider field using shortcodes.
Create a database view that combines the required data and use it as a single model, or use a PHP action to merge the datasets programmatically before generating the CSV.

Answered
Connectivity v6
an annekm 26 Aug, 2017
Hi,

I have created a view with multiple data models and would like to download this combined data in a csv file.

My DB Read function is read_data having 2 data models Ind1 and Ind2. The combined relation gives me the required relevant report.

In my csv function, in the data provider field usually we would use {var:read_data.[n].Ind1} but I would like to include {var:read_data.[n].Ind2} also.

How to correctly represent the combined array?

I tried using both by filling the Data provider field as "{var:read_data.[n].Ind1}, {var:read_data.[n].Ind2}". This did'nt work.

Only the column titles are getting downloaded, the data is empty.

Please guide me on how to proceed further.

Thanks,
Anu
an annekm 27 Aug, 2017
Answer
1 Likes
Hi

I was unable to find how to resolve this issue using ChronoConnectivity.

But for now I was able to work out a fix. Would be glad if any others have better solutions.

Instead of creating the DB table relations in Chronoconnectivity, I created the same as a view in my Database. I used the DB View as my Model and downloaded the CSV file.

Please feel free to provide any insights regarding this work around.

I would still love to know if this could be done using CC itself.

Thanks for an Awesome Extension.

Anu
Max_admin Max_admin 31 Aug, 2017
Hi Anu,

In this situation you will need someway to combine both datasets, which is not possible using shortcodes (yet), you could have done that using a PHP action before running the CSV to prepare the data list using code.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
an annekm 01 Sep, 2017
Hi Max

Hi Anu,

In this situation you will need someway to combine both datasets, which is not possible using shortcodes (yet), you could have done that using a PHP action before running the CSV to prepare the data list using code.

Best regards,
Max



I was not clear of how exactly the PHP action has to be written, hence the query.

If you could give an example it would be extremely helpful.

Thanks
Anu
This topic is locked and no more replies can be posted.