I am using showFormInDialog to present the user a list of records to choose from.
The searchform is activated by a button on the baseform.
He/She can also search in this dialogue, to reduce the number of records to choose from.
If a record is selected (by clicking a button in that record) fieldvalues are copied from the selected record in the dialogue form to fields in the baseform.
This works fine in edit mode, but in find mode it only works the first time you show the dialogue form, after that each time you show the
dialogue form a search is done automaticaly in the baseform.
I tried using a standard dialogue (showSelectDialogue), that works oke, also in find mode ,but i cannot search in it.
Is there any other way to do this ?
Or is there a plugin that i can use in findmode to do this ?
The searchform (dialogue form) does not use find/search at all.
I made a very simple sample solution :
If you set a baseform to find mode and call a dialogue form, it works the first time.
Every next time you set the base form in find mode and call the dialogue form
a search is performed immediately in the base form.
So before the user does anything. And there are no methods fired by the dialogue form.
But it wont be the solution, because on the baseform there are several fields wich each have there own searchform.
So the way i would like it to work is :
set the base form in find mode
click the button next to sereral fields and choose from the field-specific searchform
The searchcriteria will be copied to the field (for instance the name of a company)
after all criteria have been entered, either manual, or by using searchform
do a search on the baseform.
In general, I think it is good practice in Servoy to “close” find mode with a search before going on to another task – such as opening a form in dialogue. Find mode is not a “container” type of operation the way that you are using it.
Instead, chain a series of searches together with either extend, restrict or both. This gives you the flexibility to insert your form in dialogues in between searches and get predictable results.
We use autosave off and forms are in readonly mode by default.
So the user can browse, search or edit. And edit means setting readonly off and start a transaction.
Explaining the find actions :
On a form with several fields the user can start a search by entering find mode.
Then he can enter searchcriteria in each of the fields on the form.
The values for certain fields can be entered manualy and for some a combobox can be used.
For others the amount of possible values is so large that a combobox does not offer enough
functionality. So for these fields i want to use a dialogue form where the user can choose
from a large list ( over 200 records ) by searching and the choosing a value (record).
So it is not another task when a i show a dialgue form, it is part of the same task :
starting find mode, entering searchcriteria in several fields of a form, start search.
The problem is that this works fine in edit mode, but in find mode when the user clicks on a button
that shows a dialogue form, the first time the dialogue displays fine and the user can select a value.
The second time ( within this session) when a dialogue form is shown the base form where the
find was started does a search automatically. I do not want that to happen, i want stay in findmode in the
baseform and enter searchcriteria for all fields i need and then do a search.
We want to use these searchforms for instance :
to log/find a service request for a customer, a component number needs to be found
by searching in the dialogue form for a serialnumber or computertype or customer name
or system manager name or …
To enter/find a quotion a customer needs to be selected from a (long) list. In the dialogue
form part of the name can be entered and from the found records the user can select the one he needs.
to choose a productnumber and a supplier for a line within the quotation
So the dialogue (search) forms are used as an extended combobox with the advantages :
able to search before making a choice ( not by find/search, but by using a query to fill a foundset)
able to set values for more then one field when the user makes a choice.
So in “edit mode” a transaction is started and from there you allow the user to go into find mode? Seems a bit dodgy.
I understand that the workflow you want to accomplish is “one task”. But as far as the number of Servoy functions going on it is a lot of stuff. My suggestion is that you can simulate a complete search process to the user with multiple find/search steps. Initiating find mode and then going off and doing a bunch of non-related (to Servoy at least) functions before the search step is not good practice. I’m surprised it works the first time
The user goes from browse mode (readonly) to edit mode
and from edit back to browse
OR
from browse mode to find mode and from there back to browse
NOT
from browse mode to to edit and from there to findmode.
So in your “find” mode, go into find mode. Whenever a form in dialogue is triggered, do a search (extended or restricted depending on the chain) and then go right back into find mode for the form in dialogue. Do the same process when the form in dialogue is closed.
To the user, they are always in find mode. To Servoy, you’re chaining your find/searches together. That should solve any weird behaviors.