Prevent a method from running when on find

While using Smart Client:

How can I prevent a method from running when we are on find mode?

Is there something like @AllowToRunInFind, but instead @DoNotAllowToRunInFind?

Hi Juan-Carlos,

jcarlos:
Is there something like @AllowToRunInFind, but instead @DoNotAllowToRunInFind?

Nope, but you can always add logic in the method to check if you are in find mode using the following code:

if (!foundset.isInFind()) {
    // we are not in find mode, execute my code
}

Hope this helps.

Thanks Robert.

I did that and still keep getting the same error:

Exception Object: com.servoy.j2db.dataprocessing.DataException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 51' at line 1
MSG: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 51' at line 1
is a ServoyException
Errorcode: 100
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 51' at line 1
Wrapped java.lang.RuntimeException: com.servoy.j2db.dataprocessing.DataException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 51' at line 1 (C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_tabsMain_gov_proceedings.js#16)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_tabsMain_gov_proceedings.js:16 (setResult_type_of_gov_proceeding)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_tabsMain_gov_proceedings.js:30 (setProceedingTypeValues)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_proceedings_agencies_lst.js:327 (setProceedingType)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_proceedings_agencies_lst.js:308 (setTypesGovProceedingsVLS)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\frm_main_proceedings.js:109 (startFind)
	at C:\Users\jcarlos\workspace\workspace_serclipse_7_4_4\srms_workspace\FCPAC\forms\ui_crud_buttons.js:46 (enterFindModeBaseForm)

I added logic on every one of the methods listed about using if(!foundset.isInFind()). Actually, I added this condition on every of the methods above except the last two because they are the ones setting the form (and elements) on find mode. I also added that condition on the onRecordSelection and onShow methods.

Still, it’s not working. Weird,

Any other ideas?

Thanks a bunch!
JC

I found a work around:

function enterFindModeBaseForm(event)
{
	//scopes.globals.saveRecordInDB();
	var frm = forms[application.getActiveWindow().controller.getName()];
	formElementsInFindModeBaseForm();
	forms.ui_nav_forms_type.onAction_List(event); //to prevent method from running when on find because if (!foundset.isInFind()) is not working
	frm.startFind(event);
	scopes.globals.findMode = 1;
	forms.ui_nav_forms_type.onAction_Form_Edit(); //to set the search form
}

Before I run the startFind(event), I go to a simple form (see forms.ui_nav_forms_type.onAction_List(event)), then I go to the form base for data entry -which are used for search as well.