Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use logical indexes into RI
Message
From
19/07/2006 13:26:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/07/2006 07:39:51
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01137500
Message ID:
01137727
Views:
17
>When I need to just enter country only I'll use dcountry1.dbf. dstate1.dbf when I'll need only to enter state in respect of country.
>
>Actually, I am preparing an address book where user could store data as per his choice. If the user does not need district will not use ddistrict1.dbf. Others who need district will make entry in the ddistrict1.dbf
>
>All the three .dbfs to be used in separate combo of related fields in the address entry form.
>
>regards.

Well still they're redundant IMHO. A list of countries only could be derived from 3rd, and a list of states of a particular (or all) country could be derived from there as well. ie:
* Combo listing countries only
with thisform.myCountryCombo
.RowSourceType = 3
.RowSource = "select distinct country from table3rd order by 1"+;
  " into cursor crsCountries"
endwith

* Combo listing states of combo1's selected country only
with thisform.myCountryCombo
.RowSourceType = 3
.RowSource = "select state from table3rd order by 1"+;
  " where Country == crsCountries.Country"+;
  " into cursor crsStates"
endwith


* Combo listing districts of combo2's selected country&state
with thisform.myCountryCombo
.RowSourceType = 3
.RowSource = "select district,state,country from table3rd order by 1"+;
  " where Country == crsStates.Country"+;
  " and State == crsStates.State"+;
  " into cursor crsDistricts" && select * but show district only
 .ColumnCount=1
endwith
If you'd still go with 3 tables then besides your candidate keys (use candidate only for your unicity check) add an autogenerated surrogate primary key to each table. ie:
table1: PK:countryID
table2: PK:stateID FK:countryID
table3: PK:districtID FK:stateID
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform