Selecting parent value from a *LARGE* table.

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

Selecting parent value from a *LARGE* table.

Postby Neale » Thu Feb 19, 2004 11:54 am

A small puzzle....

When creating/updating a record which is the child of another table, it is sometimes necessary for the user to select the particular parent record. If there is a relatively small number of records to choose from (e.g. <<200) then a valuelist and dropdown usually suffices just fine :-)

But in the case where the parent table has a relatively large number of records (e.g. >>1000) this approach doen't scale well (nor is it too user-friendly) :-(

Any suggestions on how to approach this?

Ideally I'd like to be able to call a method/whatever as a subroutine and have the user rummage around in a pop-up search screen, review the results, possibly re-do the search and finally either select a record and return or just cancel - in either case returning to the screen they started with. But I can't see how to do this in Servoy (last time I tried, I could get a search screen in a pop-up but subsequent screens appeared in the main window).

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby IT2Be » Thu Feb 19, 2004 12:03 pm

Neale, from daily practice my client wants to work with a short code for his relations.
They search on that code...

Also they use <ctrl><f> in the (what you call) 'parent' form quite often.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby Neale » Thu Feb 19, 2004 12:21 pm

Marcel,

I think I understand what you are getting at (I too work with shortnames) and yes, the search form (same as you typically get via ctrl-F) is a good starting point.

But the issue I haven't grasped is how to invoke this search as a subroutine and at the end of the search return to exactly where we started from (possibly a half-completed form for a new record, or an existing record being updated).

Any suggestions?

Thanks,
Neale.
Neale
 
Posts: 230
Joined: Thu May 15, 2003 6:29 am
Location: Australia

Postby IT2Be » Thu Feb 19, 2004 12:27 pm

Maybe this will help, use it from a search field with a dataprovider globals.findRecord:

var original = controller.duplicateFoundSet();

if (globals.findRecord)
{
globals.recordIndex = controller.recordIndex;

controller.find();
field_to_find = "#%" + globals.findRecord + "%";

if (!controller.search() && globals.findRecord != "*")
controller.loadRecords(original);
else
controller.loadAllRecords();
}
globals.findRecord = "";

Now if you pick up (somewhere) on the globals.recordIndex and the original foundset you can go back the the form/record you were working on...

Hope this gives you a direction
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: Selecting parent value from a *LARGE* table.

Postby mattman » Thu Feb 19, 2004 8:29 pm

Neale wrote:Any suggestions on how to approach this?

Ideally I'd like to be able to call a method/whatever as a subroutine and have the user rummage around in a pop-up search screen, review the results, possibly re-do the search and finally either select a record and return or just cancel - in either case returning to the screen they started with. But I can't see how to do this in Servoy (last time I tried, I could get a search screen in a pop-up but subsequent screens appeared in the main window).

Thanks,
Neale.


Something I'm quite anxious for is the keyTyped() event. I hope they have it high in the priority list because it would allow you to control the contents of a list view (or list view within a tab panel) by simply typing into a field.

Example: I put a global field on my form named globals.typeFilter

I assign the onDataChanged event to the following...

Code: Select all
var s = "#%" + globals.typeFilter + "%";

controller.find();

field_email = s;

controller.search();

elements.typeFilter.requestFocus(false);


What happens currently is you hit the return and the change in data in the global field triggers a new search (this can also be done with onAction).

The ideal would be, each key that was pressed while in the globals.typeFilter would trigger the method.

Hopefully we'll get to use the two in conjunction. Using onDataChanged and keyTyped() or keyPressed() - whatever they call it - can be very powerful for filtering down a large set of records! But we'll have to wait until that get that feature in. :(

Fortunately, the response time from the Servoy developers is nothing short of AMAZING!!!!!! You don't wait years for features, you wait months! Keep it up Servoy devs. YOU ROCK!!!!! :D
Matt Petrowsky
mattman
 
Posts: 160
Joined: Wed Aug 06, 2003 8:23 am
Location: Murrieta, CA


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 9 guests

cron