how to export CSV with loop or php from read_data1

samir1903 23 Oct, 2019
in connectivity i can calculate things example
$total = $this->get("data_table.row.Model.calculation"); if ($total > 0) {echo $total; } else { echo 'nothing';}

to export this in a csv is kind of complex for me i couldnt do it

Can anyone help with this please
healyhatman 23 Oct, 2019
Return an array, and use that array as the data source for the CSV action. Like
$array = [];
foreach($this->get("data_table.[n].Model.calculation) as $calc") {
$array[] = $calc > 0 ? $calc : "Nothing";
}
return $array;
samir1903 23 Oct, 2019
It is not working

$array =
;
foreach($this->get("data_table.[n].Model.calculation") as $calc) {
$array
= $calc > 0 ? $calc : "Nothing";
}
return $array;




result
syntax error, unexpected ';'
healyhatman 23 Oct, 2019
$array[] supposed to be square brackets there
This topic is locked and no more replies can be posted.