Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select
Message
 
 
À
07/08/2008 06:25:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Select
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01336783
Message ID:
01337228
Vues:
7
>I had a typo in my program, I wrote Endif instead of Endfor. Also I suggest that you change == to =. This modified version works as you describe. If one or more of lxNameX match any of the nameX fields, you have a match.
>lcFromTable='x2'
>lcResultTable='crsMyCursor'
>For x=1 to 4
>   lcName=Evaluate('lcName'+Transform(x))
>   If !Empty(lcName)
>      Select * from (lcFromTable) where name1=lcName or name2=lcName or name3=lcName or name4=lcName into cursor (lcResultTable) READWRITE
>      lcFromTable=lcResultTable
>   EndIf
>EndFor
>NB! I tested it this time. :-)

Nice! You can, of course, write it as one long select too, e.g.
  Select * from (lcFromTable) where (m.lcName1=="" OR (name1=lcName1 or name2=lcName1 or name3=lcName1 or name4=lcName1) )
AND ((m.lcName2=="" OR (name1=lcName2 or name2=lcName2 or name3=lcName2 or name4=lcName2) )
AND ...
into cursor (lcResultTable)

BTW, you can exit out of the loop once you get no result, you need to add a check for this.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform