Prevent a method from running when on find

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Prevent a method from running when on find

Postby jcarlos » Fri Feb 05, 2016 12:29 am

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?
Juan-Carlos Sanchez, Stanford University - Law and Economics
jcarlos
 
Posts: 578
Joined: Thu May 04, 2006 8:55 pm
Location: Palo Alto, California USA

Re: Prevent a method from running when on find

Postby ROCLASI » Fri Feb 05, 2016 2:49 am

Hi Juan-Carlos,

jcarlos wrote: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:
Code: Select all
if (!foundset.isInFind()) {
    // we are not in find mode, execute my code
}

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Prevent a method from running when on find

Postby jcarlos » Fri Feb 05, 2016 4:48 am

Thanks Robert.

I did that and still keep getting the same error:

Code: Select all
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
Juan-Carlos Sanchez, Stanford University - Law and Economics
jcarlos
 
Posts: 578
Joined: Thu May 04, 2006 8:55 pm
Location: Palo Alto, California USA

Re: Prevent a method from running when on find

Postby jcarlos » Fri Feb 05, 2016 4:58 am

I found a work around:

Code: Select all
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.
Juan-Carlos Sanchez, Stanford University - Law and Economics
jcarlos
 
Posts: 578
Joined: Thu May 04, 2006 8:55 pm
Location: Palo Alto, California USA


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 13 guests