This topic is locked

How to hide zero values on List/View/Print pages

4/1/2016 2:29:20 PM
PHPRunner Tips and Tricks
admin

When you have a table with many numeric fields it makes sense to reduce the visual noise hiding zero values. This is how you can do this without modifying each field settings individually.
[size="3"]1. List page: Before Record Processed event[/size]

Printer-friendly page: Before Record Processed event

foreach($data as $key => $value) {

if ($value==="0")

$data[$key]="";

}

return true;


[size="3"]2. View page: Process record values event[/size]

foreach($values as $key => $value) {

if ($value==="0")

$values[$key]="";

}
L
leesayer 10/26/2017



When you have a table with many numeric fields it makes sense to reduce the visual noise hiding zero values. This is how you can do this without modifying each field settings individually.
[size="3"]1. List page: Before Record Processed event[/size]

Printer-friendly page: Before Record Processed event

foreach($data as $key => $value) {

if ($value==="0")

$data[$key]="";

}

return true;


[size="3"]2. View page: Process record values event[/size]

foreach($values as $key => $value) {

if ($value==="0")

$values[$key]="";

}


L
leesayer 10/26/2017

Would this functionality also work for fields that are blank? i.e.

foreach($data as $key => $value) {

if ($value==="")

$data[$key]="";

}

return true;
I have a database that sometimes has certain fields that are blank. When I run the List or View pages in the app, I would like the blank table entries not to be shown..