I am trying to simplify searches in my Servoy solution so that users do not have to wrap their search with ‘%’. We mostly search on Company so I am trying to show input dialog and have them enter the company name (or part) and hit OK. The following code works sometimes and sometimes leaves me in ‘find’ mode.
Any suggestions?
var likeCompany = plugind.dialogs.showInputDialog('Fast Find','Company Name');
if(likeCompany)
{
likeCompany = '%' + likeCompany + '%';
forms.company.comtroller.find();
coname = likeCompany;
forms.company.comtroller.search(true,false);
}
Servoy shows I am in find mode on method completion and the coname field has ‘%request%’. Which means it currently overwrites the coname on the current record.
Any help would be appreciated.
looks like you are invoking your search in the form “company”… but you are overwriting coname field in the selected record of the current form?.. is it “company”??
BTW… in your code you are writing comtroller and not controller… if it is a typo while writing in the forum and you are an ex-FM user the good news is that in Servoy copy and paste WORKS
. if it is not a typo and was an error in your method then I suggest you not to type the functions but to use the move code… very confortable feature ![Cool 8)]()
RE: spelling
I actually have a Mac and PC and did the post on my PC while looking at my PC monitor so it was just a typo in the forum. ![Smile :-)]()
The method is called from a popup form and once the popup form closes you are on the form company. If I should do a show form first I could add that (which may not be a bad idea) but when I tested it I WAS on the company form. The method found the correct field but did not go into find mode and wrote over the field contents with what was supposed to be the search query. When the method ended I was “supposedly” in find mode (according to the status in the lower left) but I was actually still in Edit mode.
Seems like it MAY be a timing issue. Inside the conditional I swapped the setting of the variable ‘likeCompany’ and the forms.company.controller.find() and it seems to be working now. I will test thoroughly, but it does seem to be working.