Dear Fabrik specialists, I can not display data from a repeating group in a table. I am using Joomla 3.10 and Fabrik 3.1+.
The table should grow on its own. But all the data gets into one cell through quotation marks and a comma.
There is a repeating group of 4 elements:
1) Dropdown list (monitoring_ocenka_34_repeat___LekarstPrepar_lek)
2) Simple field (monitoring_ocenka_34_repeat___FaktichOstat_lek)
3) Simple field (monitoring_ocenka_34_repeat___OstatokJurnal_lek)
4) Calc element (monitoring_evaluation_34_repeat___DifferenceRemaining_curs)
There is also Calc element (monitoring_ocenka___tabs_lec) where this repeating group is displayed in an HTML table.
Here is the content of this element:
The table should grow on its own. But all the data gets into one cell through quotation marks and a comma.
There is a repeating group of 4 elements:
1) Dropdown list (monitoring_ocenka_34_repeat___LekarstPrepar_lek)
2) Simple field (monitoring_ocenka_34_repeat___FaktichOstat_lek)
3) Simple field (monitoring_ocenka_34_repeat___OstatokJurnal_lek)
4) Calc element (monitoring_evaluation_34_repeat___DifferenceRemaining_curs)
There is also Calc element (monitoring_ocenka___tabs_lec) where this repeating group is displayed in an HTML table.
Here is the content of this element:
Code:
$myid = '{monitoring_ocenka_34_repeat___LekarstPrepar_lek}';
$myid2 = '{monitoring_ocenka_34_repeat___FaktichOstat_lek}';
$myid3 = '{monitoring_ocenka_34_repeat___OstatokJurnal_lek}';
$myid4 = '{monitoring_ocenka_34_repeat___RaznicOstat_lek}';
$myids = json_decode($myid);
$foo = FabrikWorker::JSONtoData($data['monitoring_ocenka_34_repeat___LekarstPrepar_lek'], true);
$myids2 = json_decode($myid2);
$foo2 = FabrikWorker::JSONtoData($data['monitoring_ocenka_34_repeat___FaktichOstat_lek'], true);
$myids3 = json_decode($myid3);
$foo3 = FabrikWorker::JSONtoData($data['monitoring_ocenka_34_repeat___OstatokJurnal_lek'], true);
$myids4 = json_decode($myid4);
$foo4 = FabrikWorker::JSONtoData($data['monitoring_ocenka_34_repeat___RaznicOstat_lek'], true);
$am1 = "'" . implode("','", $foo) . "'";
$am2 = "'" . implode("','", $foo2) . "'";
$am3 = "'" . implode("','", $foo3) . "'";
$am4 = "'" . implode("','", $foo4) . "'";
$arr=array(
"Name LS"=> array($am1),
"FO"=> array($am2),
"OJ"=> array($am3),
"SUMM"=> array($am4),
);
$mytable = '<table style="text-align: center; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><b>Name LS</b></td>
<td style="vertical-align: top;"><b>FO</b></td>
<td style="vertical-align: top;"><b>OJ</b></td>
<td style="vertical-align: top;"><b>SUMM</b></td>
</tr>';
foreach ($arr as $key => $value) {
$mytable .= "";
}
for ($i=0; $i <= count($value)-1 ; $i++) {
$mytable .= '<tr>';
foreach ($arr as $key => $value) {
$mytable .= "<td>$value[$i]</td>";
}
$mytable .= '</tr>';
}
$mytable .= '</tbody>';
$mytable .= '</table>';
return $mytable;
Attachments
Last edited: