determine if no data is found in search

I’m sure this is a simple solution, but can someone advise how to determine if a search returned no data and then display a specific message.
So far I tried this, which doesn’t work.

currentcontroller.search()
if (someFieldName = "")
{
plugins.dialogs.showInfoDialog( "",  "No search results found.",  "OK")
}

Thanks
Bill

Hi Bill,

I’ll usually pick up the found set in a variable and then branch off that result as follows:

currentcontroller.search()

// put the current foundset count into a variable
var v_recs = databaseManager.getFoundSetCount(forms.your_form.foundset)

//HANDLE THE BRANCHING BASED ON RECORDS BEING FOUND OR NOT
//
// if there are found records returned
if ( v_recs)  
	{ 
	// do something based on the found set - or not !
	}
else
// no records found
	{
	plugins.dialogs.showInfoDialog( "error", "No search results found", 'ok')
	}

Hope this helps

Cheers
Harry

The search() command returns the number of records found, doesn’t it?

Paul

pbakker:
The search() command returns the number of records found, doesn’t it?

it does.

Your code would then look like this:

var _count = currentcontroller.search();
if (_count == 0)
{
	plugins.dialogs.showInfoDialog("", "No search results found.", "OK");
}