On the Advanced Search I am wanting to see if the search will retrieve more than 30 rows, and if so I want to put an alert telling the user to limit the criteria more.
I am trying to use the OnValidate event, because I only see onScriptInit, onRefresh, onSave and onValidate… I could have sworn at one point I had an onFilterValidate but I sure don’t see it now.
The sc_Select macro that I have in the onValidate doesn’t seem to be running. I turned SQL debug on and it never shows it running.
For now this is my code. I am actually testing so using a customer SQL statement but once I get it working, I will replace with the sql statement that has the criteria in it.
sc_select(my_data, “select count(1) from businessaddress where state = ‘RI’”);
if ({my_data} === false)
{
echo “Access error. Message =”. {my_data_erro};
}
else
{
while (!{my_data}->EOF)
{
$Count = {my_data}->fields[1];
{my_data}->MoveNext();
}
{my_data}->Close();
}
if ($Count > 10)
{
$error_message = ‘You have selected too many’;
sc_alert($error_message);
}