Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The best way of displaying surrogate foreign keys
Message
From
13/01/1999 12:19:11
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00175383
Message ID:
00175537
Views:
43
Ian,

If I understand your question correctly, the solution is very simple. I am using combo boxes to display and select the data, but don't see any slowness so I'm not sure what that problem is. Anyways, as an example:

- Combo box to display Sales Rep while entering a customer. Want data entry to be done by entering Sales Rep name, not code.
- Combo box is built using following properties, methods:
- Row Source = array of Sales Reps
- Requery Method = SQL Select into array. My selects typically look like "Select name, code....". If the source table contains many type of codes, the SQL would contain "Where" to select correct rows.
- Bound Column property = 1. As you see from above, column 1 = Rep name
- Column Count property = 1. Don't need to show the rep code.

One of the features I really like about this method is that I can make column 1 = code + descrip. So data entry people familiar with the codes can just type the code and incremental search will fill the combo with the right item. People unfamiliar can drop down the combo to find the correct entry.

HTH,

Perry


>Hi all
>
>I'm hoping someone can point me in the right direction for displaying and validating foreign data that is based on a surrogate key.
>
>All of the tables in the system that I'm working on have hidden primary keys. All foreign keys obviously point to the surrogate primary key of the foreign file.
>
>I need to know how best to display a field from the foreign file, based on the surrogate value. At the moment we are using combo boxes, but these can be slow, especially if there is a lot of data. Also, there are occasions where the foreign key needs to be a subset of the possible values, making for a potentially complex SQL statement.
>
>Has anyone got a strategy for using text boxes to do this? The solution needs to work in grids as well.
>
>PS Using VFP 5.0a
>
>Thanks for your time,

(On an infant's shirt): Already smarter than Bush
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform