• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the best approach to search customer name to retrieve their records ?

 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm developing a desktop application in Swing for a retail shop. Using MySQL database. This application
Registers customers, employees with their personal information, also registers products and generates unique Id for each customer, employee and product.
While registering a customer we have to select an employee who will deliver products to that customer everyday. For selection of employee as delivery boy I used JCombobox in which employee surname and name ( combined surname and name with a space) will be added from existing employee records in database. In same manner I used JCombobox for adding customer's sold product information, where I have to choose employee name first in JCombobox and then all customer names registered with this employee name will be added to another JCombobox then select product from another next JCombobox. Here next to each JCombobox I kept labels which will have Id set once I chose employee name (Ex. label will have EMP101 as employee Id) amd same with customer selection(Ex. 'ÇUST109') and product. I'm using Ids to add records in database but just using names of emp, cust and product so user can understand whom he/ she is selecting to add their records.

But problem is what if more than one customers having same surname, first name and middle name ? (For employee taking surname and name only because they are only 20 max but for customers surname, first name and middle name because they may be around 4000 - 5000). Here I don't allow duplicate surname, first name and middle name but if two customers have same name then I can adjust adding initial character or making little change in their name but what If I have 100 customers having same name fileds ?

Should I use their mobile numbers which I hope be unique or name fields and mobile no ?

I can't use their Ids for entering records because user can't remember and recognize whose id that is.

For searching records I used JCombobox(String surname and first name and last name with a space in each of them) If an employee has 200 customers and 50 of them have surname "Patil" so when JCombobox is focused and I press key P then it will select first element in JCombobox with customer suname "Patil" if this is not the customer I'm looking for then press P key again then next or click on arrow on JCombobox then scroll down 100 records then select customer name . This seems not user friendly

Should I use JTextfiled to search customers records by asking user to enter surname , first name so it will show all records of customer having specified surname and name and user will select one of them ?

Customer table structure has :
customerinfo_records:

cust_id varchar(10) PK NOT NULL, cust_surname varchar(30) NOT NULL , cust_fname varchar(30) NOT NULL, cust_mname varchar(30) NOT NULL, cust_mobno1 varchar(10) NOT NULL, cust_mobno2 varchar(10), cust_balance float(10,2) NOT NULL, cust_address varchar(200) NOT NULL, cust_accstatus boolean NOT NULL, emp_id varchar(10) NOT NULL (This is id of an employee assigned to this customer while registering customer)

so please need help


 
Campbell Ritchie
Marshal
Posts: 52580
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably in the database. Database programs are specially optimised to do that sort of thing. I once experimented with a database containing 1000000000(approx) names, and the program searched for instances of a particular name in about 1½ seconds.
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1000000000(approx)
way beyond my expectation. I decided to use JCombobox. If faces any problem of redundant name fields then will use cell phone number & also found another solution i.e. will use AutoCompleteSupport with JCombobox using glazedlists_java15-1.9.1 jar. to search names. Thank you Campbell Ritchie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!