[SIZE=15px]I’m trying to create a new table and display it in a field from events.
It works, but the retrieved data is from different tables, so i want to make it showing the the row only if has data >0.
the description of the type is in different table, so now will retrieve the description from this table:
[SIZE=15px]sc_lookup(get_types_desc, "SELECT description FROM table_desc WHERE type='MYTYPE'"); [/SIZE]
Now will check one table to see if this ‘type’ is available.
[SIZE=15px]
[/SIZE]
sc_lookup, get_type1_cnt("SELECT count(id) FROM my_table WHERE ACTIVE='Y' AND type=1");
[SIZE=15px]sc_lookup, get_type2_cnt("SELECT count(id) FROM my_table WHERE ACTIVE='Y' AND type=2");
sc_lookup, get_type3_cnt("SELECT count(id) FROM my_table WHERE ACTIVE='Y' AND type=3");
sc_lookup, get_type4_cnt("SELECT count(id) FROM my_table WHERE ACTIVE='Y' AND type=4");
sc_lookup, get_type5_cnt("SELECT count(id) FROM my_table WHERE ACTIVE='Y' AND type=5");
[/SIZE]
[SIZE=15px]If it is available (>0) then display it in the table along with description… same this for type=2, type=3…etc.[/SIZE]
Here is what could do assuming to display everything retrieved, even if the count in table ‘my_table’ is 0…
$tbl_header = '<tr>
<th width=220px align=left>Type description</th>
<th width=10px align=left>Active products of this type</th>
</tr>';
$tblx_data = '
<tr>
<td width=200px align=left><font color=#19a0a0>'.{[SIZE=15px]get_types_desc[/SIZE][0][0]}.'</td></font>
<td width=10px align=left><font color=#19a0a0>'.{[SIZE=15px]get_type1_cnt[/SIZE][0][0]}.'</td></font>
</tr><tr>
<td width=200px align=left><font color=#19a0a0>'.{[SIZE=15px]get_types_desc[/SIZE][1][0]}.'</td></font>
<td width=10px align=left><font color=#19a0a0>'.{[SIZE=15px]get_type2_cnt[/SIZE][0][0]}.'</td></font>
</tr><tr>
<td width=200px align=left><font color=#19a0a0>'.{[SIZE=15px]get_types_desc[/SIZE][2][0]}.'</td></font>
<td width=10px align=left><font color=#19a0a0>'.{[SIZE=15px]get_type3_cnt[/SIZE][0][0]}.'</td></font>
</tr><tr>
<td width=200px align=left><font color=#19a0a0>'.{[SIZE=15px]get_types_desc[/SIZE][3][0]}.'</td></font>
<td width=10px align=left><font color=#19a0a0>'.{[SIZE=15px]get_type4_cnt[/SIZE][0][0]}.'</td></font>
</tr><tr>
<td width=200px align=left><font color=#19a0a0>'.{[SIZE=15px]get_types_desc[/SIZE][4][0]}.'</td></font>
<td width=10px align=left><font color=#19a0a0>'.{[SIZE=15px]get_type5_cnt[/SIZE][0][0]}.'</td></font>
</tr>
';
{table_field}="<table> $tblx_header $tblx_data </table>";
[SIZE=15px]again, this displays all the records, i want to display each row only if its count is >0…
I tried different failure attempts, nothing works so far, assuming need valid if statement within the html
any idea to shortcut this would be appreciated…[/SIZE]
[/SIZE]