In a normal form this won’t work, because in find mode , buttons are disabled and you cannot "pause’ a script like in Filemaker. However you can use a controllerForm attached to the form you want to perform your search on, because a controllerForm stays in browse mode.
Here’s a “workaround”:
Let’s assume you have a controller form called “navigator”
and a main form called “companies”
create 2 buttons in the form “navigator”
make sure they both have the property called “name” entered with let’s say “search1” and “search2”
create 2 scripts on the form “navigator”
script1 (attached to button named “search1”) currentcontroller.find() // sets form “companies” to find mode elements.search1.visible=false //hides search1 button elements.search2.visible=true // shows search2 button
script2 (attached to button named “search2”) currentcontroller.search() // executes the search on “companies” form elements.search1.visible=true //shows search1 button again elements.search2.visible=false // hides search2 button
make sure button1 sits on top of button2
Notes:
Use the “text” property to define the button text (this is displayed in browse mode)
Use the “name” property to define the button name(this is displayed in
the Method editor. (elements tree)
This script will work on ALL forms that have “navigator” as controller.
I understood your “workaround” and I tried it, but it doesn’t work.
I left the two buttons graphically separated (not overlapped) just to see exactly what happens.
Script1 works: when you click the button Servoy enters the “find” state (you can see the word “find” in the lower left corner of the window) and you can write the search criteria in the fields of the “controlled” form.
But when you click button2 (Script2) nothing happens.
Servoy remains in the “find” state and the only way I found to go on is to click on the upper menu on the comman “Select → Search” (this way the search is exactly accomplished with the criteria entered).
The fact is that while in “find” mode you can click on the button but the method is not activated.
If you enable the “method debugger” you can see that the method does not start at all.
I think I’ve correctly set up all the pieces because if Servoy is in “ready” mode then Script2 is activated when I click the botton.
I forgot to mention one important thing which is probably causing your problem.
Make sure the navigation controller has a different table then your main form has! Otherwise it will be “dragged” into the find mode as well.
I realised that in the crm demo, the navigation form also doesn’t have it’s own table. (it’s using the companies table). Bad example
In the next build, navigation controller will link to it’s own table MAIN.
It works.
I actually attached the navigator to the same table.
Now I have created a “dummy” form to be used by the navigator and all is OK.
I need another tip.
In FileMaker I can check the “omit” box in Find mode.
In Servoy is it correct to do a “controller.search” followed by a “controller.invertRecors” ?
you can use e.g “!Boston” in your find request(leaves out all records with Boston)
Invert toggles between foundset and rest of all records in table
What is the purpose of “controller.omitRecord” and “controller.loadOmittedRecords” ?
Omit sets record apart in the omit set so to speak.
It doesn’t add it to the rest of all records outside the found set like FMP does.
So if you omit 2 records in a foundset, you will also get back 2 records by doing loadOmittedRecords.
If you do invert, you’ll get back all records in table minus foundset.
Invert again , and you’ll get back found set again
Where can I find the corresponding list (FileMaker vs. Servoy) of the “symbols” I can use in a Find (I mean < > * … == and so on)?
Thank you for your information. In the previous release of the Servoy manual there was not the paragraph about “finding data”.
One more question.
I think I understood the meaning of the “invert record” command but I’m not able to let it work
I open a form, choose from the menu “select - find”, enter search criteria, choose “select - search” and obtain the correct “foundset”
Now I do “select - invertrecords” and I expect to obtain the complementary set (i.e. all the records except those founded before) but instead I obtain a “no result”
This in my trial database.
I’ve also tested your “crm” database but it’s the same.