IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 0
|
I am using the table to display the output voltages for like 9,000 power supplies. These power supplies could have up to 4 voltages. Here is the syntax I was planning to use:
{$columns:V1} V<br>{$columns:V2} V<br>{$columns:V3} V<br>{$columns:V4} V
The issue is that most of the supplies only have one output, which would make my table look odd, is there a way to include an IF value = 0 skip the value and my extra "V" at the end?
Please advise.
|
|
|
|
|
Re:IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 760
|
Hello,
Do you load data from a database?
Regards,
ARI Soft
|
|
|
|
|
Re:IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 0
|
I load from the local database
|
|
|
|
|
Re:IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 760
|
You can use SQL query in the next way:
Code: |
SELECT
CONCAT(
IF(LENGTH(IFNULL(V1, '')) > 0, CONCAT(V1, '<br/>'), ''),
IF(LENGTH(IFNULL(V2, '')) > 0, CONCAT(V2, '<br/>'), ''),
IF(LENGTH(IFNULL(V3, '')) > 0, CONCAT(V3, '<br/>'), ''),
IF(LENGTH(IFNULL(V4, '')) > 0, CONCAT(V4, '<br/>'), '')
) AS V
FROM
tbl
|
Regards,
ARI Soft
|
|
|
|
|
Re:IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 0
|
I tried to implement your example into what I am doing, but was unsuccessful. Below is the syntax I am starting with:
SELECT
OUI.factory, OI.part, OUI.factory2, OUI.series, OUI.power, OUI.convection, OUI.type, OI.V1, OI.A1, OI.V2, OI.A2, OI.V3, OI.A3, OI.V4, OI.A4, OI.Efficiency, OUI.dimensions
FROM
jos_part OI INNER JOIN jos_series OUI ON OI.series = OUI.series
WHERE OI.V2 > 0 AND OUI.type = 'Open Frame' AND OUI.safety = ''
I need the V1 and A1 values to not display if their value is NULL, and if they are present to display a V or A after their value (V for V# and A for A#).
Thanks for the help,
Gorden.
|
|
|
|
|
Re:IF THEN Capabilities 13 Years, 2 Months ago
|
Karma: 760
|
In your original post, you want to show V1, V2, ..., VN in one column on frontend and the solution from our previous post can be used for this. Do you want to show V1, A1, ...,Vn, An values in separate columns? If yes, it is not possible to hide Vn column if it has NULL in all records selected from database.
Regards,
ARI Soft
|
|
|
|
|
|