Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clearing Combo Box Choices
Message
De
29/04/1999 03:10:47
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/04/1999 09:57:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00211482
Message ID:
00213338
Vues:
42
>Hello Cetin:
>
>** I am glad everything is OK with you and your family, concerning the car accident. That is certainly good news.
>
>
>Also, thanks for your help with clearing my combo boxes. Your note was very helpful.
>
>> I have another question regarding my search form. I have spent the last two weeks getting my combo boxes to work correclty, and I am proud to say they finally are working the way I intended for them to work! Now that they are pulling the correct data, I need for the user to be able to "fetch" what they "searched" for.
>
>The search form has 6 combo boxes:
>
>1. Country
>2. State
>3. County
>4. Locality
>5. District
>6. Office Title
>
>The whole purpose of the search form is for the user to find a specific political office, anywhere in the world! For the time being it is just pulling data from 2 states, but in the future it will be global.
>
>The last three combo boxes (#4, #5, #6), indicate a specific office.
>
>Example, the user may select:
>
>1. USA
>2. Florida
>3. Dade
>4. Miami
>5. 56
>6. City Commissioner
>
>
>Miami, 56, & City Commissioner indicate the specific office the user is looking for. I have an OFFICES form (which is storing its data in an offices table) that is holding that specific office.
>
>*** GOAL ***
>I would like to have the user press a command button called GO (on my search form), and have my OFFICE form pop up with the record of that specific office (Miami, 56, City Commisssioner) showing.
>
>What is the best way to go about doing this proceedure?
>
>My specific concern is how to call the correct record in my OFFICES form when I am not referring to a specific id number. I am trying to match text from 3 combo boxes on my search form, to 2 combo boxes and 1 textbox on my OFFICES form, that are holding the exact same information. Is this possible?
>
>If you have any ideas, I would sure like to hear them.
>
>TIA
>
>Jason
Jason,
Sorry for the delay.
First it's possible :) A nice example of hierarchy :) As I could see not only #4-6 but #1-6 indicate a specific office and tables should be related in a way. You could do a match to a number of criteria but at the end if you're gonna get one specific office then it's wiser to get its id via a select and use it. It would be fast with ?illion records too. I don't advise any matching via filters because despite rushmore and how best you create your indexes filter is slow (I'm not open to discussion of "filter" speed-take it as personal idea). I don't know the relations but your SQL would look like :
select of.id ;
  from offices of ;
   join districts ds ;
      on ds.ofid = of.id ;
   join localities lo ;
      on lo.dsid = ds.id ;
   join counties co ;
      on co.loid = lo.id ;
   join states st ;
      on st.coid = co.id ;
   join countries cou ;
      on cou.stid = st.id ;
   where ;
      cou.country == thisform.cmbCou.value ;
      and st.state == thisform.cmbSt.value ;
      and co.county == thisform.cmbCo.value ;
      and lo.locality == thisform.cmbLo.value ;
      and ds.district == thisform.cmbDs.value ;
      and of.offtitle == thisform.cmbOf.value ;
   into array aOffices
if type("aOffices") = "U"
   * No office found
else
   if alen(aOffices,1) > 1
      * Ooops. More than one office matched
      * This should never happen
   else
      do form offices with aOffices[1]
   endif
endif
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform