Our app loads forms dynamically (into a main form with tabless panels). One of the drawbacks of such an approach is that a Find has to be done programatically, i. e. a form (each form where appropriate) has to be brought into Find mode with the onFindCmd event. I could make that work.
Now I am stuck because I need to do an OR Find. That means after the first Find I have to bring the form (which is already in Find mode) into Find mode again to enter the the second Find argument.
How do others deal with such a situation (occurs also for Find in Find).
Well, you could use the onFindCmd event of the main form to execute a method and enter find mode in the form currently loaded in the tab panel.
In that method you could also check to see if the form is already in find mode and add a new search criteria if true.
Usually to handle what you call “Find in Find” I display a FID after the criteria has been entered asking the user if they want to narrow the current foundset, extend the current foundset or perform a new search on the whole db.
Exactly what I am looking for I am doing just what you suppose - only problem at the moment is how to get the info about the state (find OR data mode) of the form. I don’t find a method or property!?
I assume you mean by FID (Form In Dialog), correct?
Thanks, Robert
PS: By the way, do you have no problems putting forms into Find mode this way if there are relationships associated?
ngervasi:
Well, you could use the onFindCmd event of the main form to execute a method and enter find mode in the form currently loaded in the tab panel.
In that method you could also check to see if the form is already in find mode and add a new search criteria if true.
Usually to handle what you call “Find in Find” I display a FID after the criteria has been entered asking the user if they want to narrow the current foundset, extend the current foundset or perform a new search on the whole db.
Exactly what I am looking for I am doing just what you suppose - only problem at the moment is how to get the info about the state (find OR data mode) of the form. I don’t find a method or property!?
I assume you mean by FID (Form In Dialog), correct?
Joas already hinted the right function
Yes, by FID I mean a Form In Dialog called by the onSearch event of the form used for finding.
Robert Huber:
PS: By the way, do you have no problems putting forms into Find mode this way if there are relationships associated?
What do u mean exactly?
In the main tab usually only unrelated forms are loaded.
You are certainly right that in the main tab are unrelated forms loaded. But some of these unrelated forms (loaded into one of the tabless panels in the main form) contains relations (“hardwired”) to subforms. And in this constellation it’s very difficult to get a stable find result and it’s also difficult to debug. I assume it can be done correctly but one has to set all (onFindCmd) events appropriate, to make it work. So that was the intention of my question, how you and others handle with such complexity and the Find mode.
Regards, Roberto
ngervasi:
Robert Huber:
PS: By the way, do you have no problems putting forms into Find mode this way if there are relationships associated?
What do u mean exactly?
In the main tab usually only unrelated forms are loaded.
You are certainly right that in the main tab are unrelated forms loaded. But some of these unrelated forms (loaded into one of the tabless panels in the main form) contains relations (“hardwired”) to subforms. And in this constellation it’s very difficult to get a stable find result and it’s also difficult to debug. I assume it can be done correctly but one has to set all (onFindCmd) events appropriate, to make it work. So that was the intention of my question, how you and others handle with such complexity and the Find mode.
Regards, Roberto
It works well for me and it’s pretty simple.
Let’s suppose you have the main form with the main tab panel and you load inside the tab panel form A (customer details, record view), inside form A you have a tab panel showing form B through a relation (invoices linked to the selected customers).
You create a method in the main form hooked to onFindCmd that calls find mode in form A:
If the user enters a search criteria in the CustomerName field servoy performs a simple find on the customers table;
If the user enters a search riteria in the InvoiceNumber field in the invoices tab panel, servoy finds the customer that is linked to that Invoice record;
If sometimes you don’t want the user to be able to search on related data like the above for some forms you can simply create a find method specific for that form (in which you can disable the related tabpanel) and check in the main form like this (from the top of my head, check the syntax):
Yes, I get the idea, I do something similar and like to check with my methods and code to see if there is somewhere a difference to your ideas.
I have one case where on a subform to subsubforms are (again) dynamically loaded, as this is required because it depends on a condition. I could do the condition handling with “hardwired” forms and 2 tabs, but I did it with dynamically loading the (subsub)form into the subform. So I have to chech my chain of Find again to recap what’s happening.
Thanks, Robert
ngervasi:
Robert Huber:
Hi Nicola
You are certainly right that in the main tab are unrelated forms loaded. But some of these unrelated forms (loaded into one of the tabless panels in the main form) contains relations (“hardwired”) to subforms. And in this constellation it’s very difficult to get a stable find result and it’s also difficult to debug. I assume it can be done correctly but one has to set all (onFindCmd) events appropriate, to make it work. So that was the intention of my question, how you and others handle with such complexity and the Find mode.
Regards, Roberto
It works well for me and it’s pretty simple.
Let’s suppose you have the main form with the main tab panel and you load inside the tab panel form A (customer details, record view), inside form A you have a tab panel showing form B through a relation (invoices linked to the selected customers).
You create a method in the main form hooked to onFindCmd that calls find mode in form A:
If the user enters a search criteria in the CustomerName field servoy performs a simple find on the customers table;
If the user enters a search riteria in the InvoiceNumber field in the invoices tab panel, servoy finds the customer that is linked to that Invoice record;
If sometimes you don’t want the user to be able to search on related data like the above for some forms you can simply create a find method specific for that form (in which you can disable the related tabpanel) and check in the main form like this (from the top of my head, check the syntax):