I have a CSV-Action with
Data provider: {var:read_data.[n].export}
Action: Download
and in Titles:
datum:Datum
beobachtung:Beobachtung
mtb_id:MTB
...
In the read_data-Function 6 connected tables with models
Select type: All matching record
Where conditions:
user_id = {user:id} Use
Fields to retrieve:
Beobs.datum:export.datum
Beobs.beobachtung:export.beobachtung
Beo-Ort.mtb_id:export.mtb_id
...
This is an extra fields list: yes
I get a warning message. What is the problem?
F.
I've created a PHP action (csv_data) with code: return [$ this-> data];
In the CSV action (csv1) in the data provider: {var: csv_data}
As Action: Store and download
Storage path: {path: root} /csv/export.csv
The warning message is gone, but I only have the column headings in the CSV file.
Where exactly do I have to insert the debug?
at the end of your event (page) where the csv will be created (like other views or functions)
Under Events-Tab:
index
<div id="view_articles_list" >
{fn:read_beobachtungen}
{view:beobachtungen_list}
</div>
{view:export_csv_button}
<div class="ui segment">
{view:beobachtungen_paginator}
</div>
export
{fn:csv1}
{debug:csv1}
{fn:redirect5-off}
The debugger is not displayed.
If the debugger is in index-event, then everything from the connected tables will be displayed to me in read_views.
this is my new stand:
I can not save the data from the "Table list" to a CSV file.
The frontend shows my table list. The content should be exported but something else is in the CSV file (screen1).
In the CSV action (csv_export), this is in the data provider: {var:read_observations.0}.
I do not know how the data provider has to be right.
This is my read data action (screen2).
What am I doing wrong?

But then I get the warning:
"warning: fputcsv () expects parameter 2 to be array null given in ..."
I also tested a php action afterwards with the content:
return [$this->data];
or
return["datum" => $this->data("Datum"), "Beobachtung" => $this->data("beobachtung")];
that only showed me the column headings and no other content ....
Array
(
[99b2] => 2899
[84a67] => 4501
[joomla_user_state] => logged_in
[Itemid] => 942
[option] => com_content
[view] => article
[id] => 15
[export] =>
)
Array
(
[read_beobachtungen] => Array
(
[log] => Array
(
[0] => SELECT `Beob`.`beof_id` AS `Beob.beof_id`, `Beob`.`user_id` AS `Beob.user_id`, `Beob`.`beo_id` AS `Beob.beo_id`,
......
)
[var] => Array
(
[0] => Array
(
[Beob] => Array
(
[beof_id] => 2
[user_id] => 909
[beo_id] => 4
[datum] => 1939-04-01
[beobachtung] => Am Tag
[teilnehmer] => Anton Hinkel
[datenweitergabe] => 0
[created] => 2019-09-09 19:24:50
[modified] =>
)
[Melder] => Array
(
[id] => 909
[name] => Fred O
[username] => admin
[email] => nat@so.de
.....
(
[99b2] => 2899
[84a67] => 4501
[joomla_user_state] => logged_in
[Itemid] => 942
[option] => com_content
[view] => article
[id] => 15
[export] =>
)
Array
(
[read_beobachtungen] => Array
(
[log] => Array
(
[0] => SELECT `Beob`.`beof_id` AS `Beob.beof_id`, `Beob`.`user_id` AS `Beob.user_id`, `Beob`.`beo_id` AS `Beob.beo_id`,
......
)
[var] => Array
(
[0] => Array
(
[Beob] => Array
(
[beof_id] => 2
[user_id] => 909
[beo_id] => 4
[datum] => 1939-04-01
[beobachtung] => Am Tag
[teilnehmer] => Anton Hinkel
[datenweitergabe] => 0
[created] => 2019-09-09 19:24:50
[modified] =>
)
[Melder] => Array
(
[id] => 909
[name] => Fred O
[username] => admin
[email] => nat@so.de
.....
So with several tables, the csv function does not work
Only the content of a table is exported with a model.
if i want to export linked tables with multiple models then this will not work.
Only the content of an array is taken over.
F
And in fields to retrieve you may need to also include all the fields you will be joining on - so if a second model needs column_a, make sure you're retrieving it.
