I'd do it somethign like this: // Datagrid Filter public function processFilter(item:Object):Boolean {
var result:Boolean=true; var pattern:RegExp = new RegExp("^"+userIDFilter.text,"i"); if(item.UserID != null && !item.UserID.match(pattern))return false; if(item.FirstName != null && !item.FirstName.match(pattern))return false; ect return true; } That what you are looking for? On Wed, Mar 12, 2008 at 8:04 AM, JRBower <[EMAIL PROTECTED]> wrote: > > I have a filter function that works fine so long as there is data in each > column. In the following function a flight number (FlightNumber) hasn't > been > added so any search attempt (i.e., filter on FirstName, LastName or > UserID) > results in a #1009 error. > > // Datagrid Filter > public function processFilter(item:Object):Boolean > { > var result:Boolean=false; > var pattern:RegExp = new RegExp("^"+userIDFilter.text,"i"); > // If no filter text, or a match, then true > if (!item.UserID.match || item.UserID.match(pattern) || > !item.FirstName.match || item.FirstName.match(pattern) || > !item.LastName.match || item.LastName.match(pattern) || > !item.FlightNumber.match || item.FlightNumber.match(pattern)) > > result=true; > return result; > } > > How can I make this function filter (filled fields) even when one field is > still empty, thus avoiding the "null object reference". > > Thanks, > > James > -- > View this message in context: > http://www.nabble.com/Filter-function-%22Sort%22-of-working-tp15999711p15999711.html > Sent from the FlexCoders mailing list archive at Nabble.com. > > > -- Giles Roadnight http://giles.roadnight.name