function ifnull(val, def){ if(val == "" || val == null || val == "null" ) { return def; } else { return val; } }