Normal Topic Selection Box Revisited (Read 1405 times)
Duane
Member
*
Offline


New at this, will have
many newbie questions!

Posts: 18
Location: Virginia
Joined: Jan 22nd, 2004
Selection Box Revisited
Jan 30th, 2004 at 9:38pm
Print Post Print Post  
Reading through the threads of creating a pop up list or selection box I tried to apply this to my application, with some changes, but they are not working.

I have two applications with one db per (both will eventually be merged and the x commands will need to be changed, but).  The first db is Buildercodes, which holds the information per client per project.  Example : builder will have many projects, and each project is billed individually, so each project has a "buildercode" which is unique.  For further example the builder Toll Bros. will have two projects one called South Riding Glen, one called South Riding Fairways, but the builder codes/client information is differents so the "buildercode" is different, TOLL26.3 and TOLL26.4, respectfully.

In the second database we store the individual permits issued for the above projects, mind that we have over 80 active projects.  When entering a permit for a project, I have xlookup pull the project, section, etc from the first database using the buildercode (TOLLxx.x).

What I want to acomplish, if possible, is to have the user start typing in TOLL in the buildercode element and then a pop up list of the "Projects" is given, and when the correct "Project" is selected if will fill in the "buildercode", then the existing xlookup commands will fill in the rest.

As you can see, doing the selection list from the element that is being filled in can go in length of 50+ and still only showing the buildercode only gives the code and not the project, so mistakes are more easily made at entry, ie picking a word with a number and not the project name.

Any Advice?????

Duane
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection Box Revisited
Reply #1 - Jan 30th, 2004 at 11:17pm
Print Post Print Post  
Duane,

Do I understand you correctly; you want to have a field element that the user would type in the first part of the name, say tol

Then press enter and they  would be presented with  a selection list that has all the customers starting with TOL like told, told1 etc and then that element would be used to do xlookups and fill the needed elements.?

Or

Do you want to have a field element that the user would type in the first part of the name, say tol and be presented with a selection list of the full project name associated with all the tolds that would then be used to fill the needed data elements?
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Duane
Member
*
Offline


New at this, will have
many newbie questions!

Posts: 18
Location: Virginia
Joined: Jan 22nd, 2004
Re: Selection Box Revisited
Reply #2 - Jan 31st, 2004 at 4:52am
Print Post Print Post  
The "or" is correct.

To explain further, currently the Q&A databases are bldcodes.dtf and permits.dtf.  When a user enters a new permit into permits.dtf the user addes the "code" which relates to a "buildercode" in bldcodes.dtf.  Where we have problems is when a typo is made to that entry and the permit is liked to the wrong project.

It is hard to explain, but here goes about how bldcodes is setup.  First is the standard information that one would keep for a client, name, address, phone, etc.., but the unique "key" we use is called buildercode.  The code is usually the first 3 to 5 letters of the clients name, then a number, and sometimes a subnumber.  This is hard to put into words without some examples.

Client, Project, Code
Toll Bros., South Riding Glen, TOLL26.1
Toll Bros., South Riding Fairway, TOLL26.2
Toll Bros., Belmont Carriages, TOLL23.4
Toll Bros., Belmont Tournaments, TOLL23.8

Now this just represents one of many clients that have projects which are actually in the same subdivision, but they are billed to different managers.  So, the data entry errors have been either the user dosen't remember the correct code or needs to close permits.dtf, search bldcodes.dtf, then reopen and enter a permit.

To help avoid these memory errors and constant searching then adding, I would like to do a selection list, but with a small catch.

I have created and have no problem doing just for the element code (showing a list of all the codes 1600+).  I would like to make a pick list that narrows down the codes and help reduce errors, by having the it use the first couple of letters typed, but instead of showing the codes, to show the project.  Once the project is selected it will populate the code element with the correct code.

If this makes no sense, I appologize, but our clients are not your standard clients on how they are billed since each project is somewhat of a client of its own, therefore each project gets its own code, but to keep them somewhat related they have the numbered parts.

Is what I'm looking for possible?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Selection Box Revisited
Reply #3 - Jan 31st, 2004 at 5:56am
Print Post Print Post  
How about displaying the whole lines

TOLL26.1, Toll Bros., South Riding Glen,  
TOLL26.2, Toll Bros., South Riding Fairway,
TOLL23.4, Toll Bros., Belmont Carriages,
TOLL23.8, Toll Bros., Belmont Tournaments,  


You will have to create one more element into the layout form from which this list is made. Let's say the that element name is  "Display", so on Form exit event code will be

Display = code + ", " + client + ", " + Project + ","

or if you prefer other way like;

Display = code + ", " + Project + ", "+ client  + ","

Initially you may have this element as read only and later on make it invisible so it will be totally inconspicuous.

Now you just want to pick up just code into the field:

so the code will be like this

var v_result as string
var v_start as string
var v_end as string

v_start = yourcurrentelement

v_end = v_start + "zzzzzzzz"
v_start = v_start + @chr(1)


v_Result = @xuserselectr ("C:\sesame\data\yourfile.db", "yourform!display", "code", v_start, v_end)

Yourcurrentelement = v_Result

Following you will have to replace with appropriate names as per your application:
Yourfile.db is your application name
Yourform is the form name you are getting values for display and code from
Yourcurrentelement is the name of element you are putting this code.
"C:\sesame\data\yourfile.db" can be replaced by @fn if you are working with the same application.

If you want to populate the other fields, you can do that by @xlookup or xlookup using the Code as the key. This should do it.

Bob Scott will probably add some more clarity to this and correct me where I am wrong. Thanks Bob.

 
« Last Edit: Jan 31st, 2004 at 1:33pm by Bharat_Naik »  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection Box Revisited
Reply #4 - Jan 31st, 2004 at 4:22pm
Print Post Print Post  
Bharat,

I was going down the same thought process you are.

With the features we understand from Sesame so far, I would do it as you explained.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Duane
Member
*
Offline


New at this, will have
many newbie questions!

Posts: 18
Location: Virginia
Joined: Jan 22nd, 2004
Re: Selection Box Revisited
Reply #5 - Feb 2nd, 2004 at 4:31am
Print Post Print Post  
Bob,
That way of thinking is why I come to this Forum.  Will have to give that a try, hopefully get it in an tested by late Monday.

Just to clarify that the variable declarations go in Global, and then the rest in the on element exit programing.

Also can anyone explain in english the difference between Form Events and Form Element Events.  Reading the manual, they seem to do the exact same thing and the all seem to relate to the element.  So it has got me confused.

Duane
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection Box Revisited
Reply #6 - Feb 2nd, 2004 at 6:16am
Print Post Print Post  
Quote:
Just to clarify that the variable declarations go in Global, and then the rest in the on element exit programing.


Duane,

Place it all in the on element exit.

I find that the simplest ways to accomplish these tasks are 1 step at a time.

First in the database you are going to retrieve the data from create the new element as Bharat has suggested.  The first part of your element needs to be what you will actually search on. In Bharats example
You are making an element just for displaying, this is how your user will decide what company to choose
So in the lines below you started with the code first then company name then project name
This gave you data formatted like such

TOLL26.1, Toll Bros., South Riding Glen,
TOLL26.2, Toll Bros., South Riding Fairway,
TOLL23.4, Toll Bros., Belmont Carriages,
TOLL23.8, Toll Bros., Belmont Tournaments,

So when you type TOL in your search element, it would return all the choices above in the selection box.

(The simplest method for you at this time might be to mass update existing data into the new display element and add logic so every time new data is entered it places the data correctly in the display element.)

Once you have your display data element correct in the database you are retrieving from step 2 will be to open the database that holds the element you are going to have the selection box used with  and  add the code Bharat described earlier into the on element exit program area.

I would then reconcile and test the database and be certain the selection box is working properly.

Once you are happy with the selection box move to step 3 and use Xlookup logic to fill the fields.

If anything is not clear give us a shout. We are all learning together, and between all of us together we will figure it out.  Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Duane
Member
*
Offline


New at this, will have
many newbie questions!

Posts: 18
Location: Virginia
Joined: Jan 22nd, 2004
Re: Selection Box Revisited
Reply #7 - Feb 2nd, 2004 at 1:35pm
Print Post Print Post  
Okay, here is what I did.  Saved the application buildercodes.db as a new application buildercodes2.db.  Went and added the element "PRMTSEARCH", with programing of on element entry to combine code and project with ", " seperation.  Then reconciled the application, preformed the mass update with the same programing and everything went perfect. 

Went and did a 2nd copy of the permits.db called permits2.db.  Commented out the existing xlookup statements and added the following code:

var v_result as string 
var v_start as string 
var v_end as string 
 
v_start = CODE 
v_end = v_start + "zzzzzzzz" 
v_start = v_start + @chr(1) 


v_Result = @xuserselectr ("C:\sesame\data\BUILDERCODES2.db", "BUILDERCODES!PRMTSEARCH", "CODE", v_start, v_end)

CODE = v_Result

It performs the lookup perfectly, but once I select the proper code/project, the "Code" element remains blank, any suggestions?

  
Back to top
 
IP Logged
 
Duane
Member
*
Offline


New at this, will have
many newbie questions!

Posts: 18
Location: Virginia
Joined: Jan 22nd, 2004
Re: Selection Box Revisited
Reply #8 - Feb 2nd, 2004 at 2:14pm
Print Post Print Post  
All fixed it was the line v_Result, I had left the source as "code", it should have been "buildercode".

After testing it worked perfectly, uncommented my xlookup statements and now the whole thing works perfect.

THANK YOU ALL FOR THE GREAT ADVICE, ONCE AGAIN
Grin Grin Grin Grin
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection Box Revisited
Reply #9 - Feb 2nd, 2004 at 2:19pm
Print Post Print Post  
Congratulations Cheesy

Great job Smiley

It a great  feeling when you get things to work the way you want.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged