Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clearing Combo Box Choices
Message
De
03/05/1999 02:10:03
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/05/1999 16:02:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00211482
Message ID:
00214481
Vues:
37
>Hi Cetin - It is always good hearing from you. Thanks for writing a reply to my last message, even though you were running short on time.
>
>I will keep this message short -- I promise!
>
>I have the following code placed into the CLICK() of my search form:
>
>with thisform.cmbofficetitle_search && Combo's name
> m.myofficeId = .List(.ListIndex,2) && memvar
>endwith
>
>if !empty(m.myofficeid)
> do form OFFICES with m.myOfficeId
>endif
>
>
>The only thing I am missing to get the OFFICE form to fire is the "conversion code" for nofficeid, which is the second column value in my last combo box (cmboffice_search).
>
>I am going to do some reading in my FoxPro books to figure out how to "convert" this field into a character value. I hope to have good news to report to you this coming week.
>
>
>Look forward to hearing from you
>
>Jason
Oh in a hurry I forgot your "id" was numeric. Here is the corrected converted one :
with thisform.cmbofficetitle_search  && Combo's name
   m.myofficeId = val( .List(.ListIndex,2) ) && memvar
endwith

if !empty(m.myofficeid)
   do form OFFICES with m.myOfficeId
endif
Some conversion functions for future reference :
val(CharValue) && Convert char to numeric
ie: val( "123" ) gives numeric 123
str(123) gives char "123"
dtoc(DateValue) && Date to a char value
dtos(DateValue) && Date to a string value
dtoc({1/1/1999}) gives "01/01/1999"
dtos({1/1/1999}) gives "19990101" - suitable for indexing
ctod(CharValue) is the counterpart of dtoc() converting char to date value.
Well there are others and you could find these in help but converting logical have no special function. You could use iif() for that :
iif(LogicalValue,"Yes","No") && You could replace yes and no with anything you like. In the same manner you could say iif(LogicalValue,1,0) and make it numeric.
Now why we didn't use :
Offices.nOfficeid = val( .List(.ListIndex,2) )

Whatever you write on the right operand would be assigned to left operand (val(..) and offices.nOfficeid respectively). But with fields you can't do assignment like this. It doesn't give error but simply ignored. Also if it was not the case still it wasn't something we would do b/c we don't want to change any value in Offices.nOfficeid field, just store and pass it to "offices" form.

You and thousands of other lovely UT members took me to the finest restaurant I can think of 2 days ago :) With the support of UT community I got MVP award and I really appreciate it :)
You could cause others to get it so feel free to ask any question on UT :)
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