This topic is locked
[SOLVED]

 View Custom code

1/31/2018 5:13:21 PM
PHPRunner General questions
P
Penultimatum author

I have set custom code in my view settings for fields in a table, but it appears if the value is an integer and empty the custom code is not called?
My view page seems to get out of alignment when there is no value for a field, so I was trying to use custom view code to set the value as such:



if ($value == '') {

$value = '--';

}


This works fine for fields which are strings and empty, but not integers. For my integer fields I tested "$value=999;" - and in this case records with an empty value showed nothing, and any which had value set showed "999". Is the custom code not called when the field is an integer and not set?
I just want to show a "--" or something for empty fields to maintain view alignment, and need to show the field rather than hide to be clear its not defined. Thanks.
Jim.

P
Penultimatum author 1/31/2018

Actually it doesn't appear to be the case with all integer fields on my form, just some of them..

P
Penultimatum author 1/31/2018

OK, I don't understand why it wasn't working, but found another way by setting the value in the "Process record values" even for the View page with:
if (empty($values["MYFIELD"])) {

$values["MYFIELD"] = "--";

}