Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Nilson Rishi
  Where is Nilson Rishi?
 Bangkok
 Thailand
 Nilson Rishi
 Tags
Subject: RE: performance issue with remote view
Thread ID: 104117 Message ID: 104146 # Views: 2 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Saturday, August 12, 2006 1:40:04 AM         
   


> What if a user completely forget any valid customer code, or he/she could not link a code to a customer name?
>
> Regards,
> Nilson


Nilson,

Give the user a candidate list as Jim suggests. Your user won't really care about the appearance if it takes any more than a second or so to load the data. As a rule of thumb, anything more than a heartbeat is too much load time.

You can create a very effective look and feel AND you can keep your load time quick. I use a table driven approach. A simple version of this can be created using a single table. Create a table with the following fields: ID (autoinc Integer record ID), SearchType (Character), SQLScript (Memo), DispSort (Integer)

You display the search type in a dropdown list in DispSort order (the most used search is first). The user selects the type of search (Surname, CompanyName, Phone Number, PostalCode, Customer ID, or what ever you have) and then enters some appropriate text in a textbox. Control source that textbox to a variable. The user then hits a "FindIt" button that calls the search procedure that populates a candidate list (actually, use a grid rather than a list.) In the search procedure you simply run the SQL SELECT statement located in the SQLSript field. For example, if your user wishes to do a search based on surname, s/he would select Surname from the dropdown, enter "Murphy" as the text and click the FindIt button. The search proc would look at the table and find something like:
SELECT LEFT(cSurname-(" "+cTitle)-'(" "+cFirstName),30) as cCustName, ;
       iCustomerID], ;
       cCustomerType, ... ;
   FROM MyCustomerTable ;
   WHERE LIKE(?UPPER(ALLTRIM(lcSearchText))+[*],cSurname)

Your search proc would actually run
lnRetVal = SQLEXEC(gnHndl,lcSQLScript,[SQLResults])
SELECT MyGridCursor
ZAP
APPEND FROM SQLResults
This.ResultGrid.SetFocus
This.ResultGrid.Refresh


The great thing about this sort of approach is that it is easy to add new search types. Let's say your user now wants to have the ability to search by last payment date. Not a problem - you just add a new record to your search table and enter a SELECT statement into the memo field. Done!

This can actually look pretty good as well. Take a look at something I am working on (changing the listbox to a grid)


This approach does two things:

1 - it limits the number of fields that you are downloading to the client, and
2 - it limits the number of records that you are downloading to the client.

By doing this, I minimize the amount of data that I have to send to the client - in this case, over a slow internet connection. In this case the search type "All" is a bit misleading - it means all of the children from a specific region. The list is populated in less than a second even over a slow internet connection. The user clicks on a record in the candidate list and I SELECT all of the fields but for only one record (I use the child record ID displayed in the candidate list.) To populate the rest of the form (4 pages worth of data) is almost instantaneous.

Give this approach a try, and then show it to your users. They will love you for it. They will also love your ability to quickly add new search types.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

performance issue with remote view Posted by Nilson Rishi @ 8/11/2006 4:54:12 PM
RE: performance issue with remote view Posted by Martin Sellwood @ 8/11/2006 5:07:20 PM
RE: performance issue with remote view Posted by Bernard Bout @ 8/11/2006 5:41:43 PM
RE: performance issue with remote view Posted by Nilson Rishi @ 8/11/2006 6:07:03 PM
RE: performance issue with remote view Posted by Jim Winter @ 8/11/2006 6:22:31 PM
RE: performance issue with remote view Posted by Nilson Rishi @ 8/11/2006 6:35:47 PM
RE: performance issue with remote view Posted by Kiran Kumar Singh @ 8/11/2006 7:16:34 PM
RE: performance issue with remote view Posted by Ken Murphy @ 8/12/2006 1:40:04 AM
RE: performance issue with remote view Posted by Nilson Rishi @ 8/12/2006 4:35:12 AM
RE: performance issue with remote view Posted by tushar @ 8/12/2006 1:29:17 PM
RE: performance issue with remote view Posted by Nilson Rishi @ 8/12/2006 5:32:29 PM
RE: performance issue with remote view Posted by Ken Murphy @ 8/12/2006 2:53:31 PM
RE: performance issue with remote view Posted by Nilson Rishi @ 8/12/2006 5:28:46 PM