Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seek Cammand
Message
De
15/09/2000 18:15:05
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
15/09/2000 17:18:42
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00417199
Message ID:
00417213
Vues:
24
Hi Steven

>>I am having troubles. I have two character fields in a table. I have created an index called pcloc (PadR(field1 + " " + field2,24,' '). In code I use Select myTable, Seek(PadR(variable,24,' ') Order psloc. I feed the variable with aknown record value and I still get not found. What am I doing wrong?
<<

Well, for one, if you created a tag called pcLoc and tried to search using pSloc, I'd bet that would cause a problem. I think you made a typo in your correction. The likely problem is that your variable's content doesn't match field1+" "+field2. For example ... your record contains "Mike" in field1 and "Yearwood" in field2. Field1 is c(10) and field2 is c(15). The index Expression would be...

"Mike Yearwood ". I bet your variable contains "Mike Yearwood". If as someone suggested, you make your index expression with alltrims you will have better results. Like this...

PadR(alltrim(field1) + " " + alltrim(field2),24,' ')

However, if you are not careful about the space you've included between field1 and field2 in the expression, you will not find a record if your variable contains "Yearwood" because the first name wasn't specified.

In this case, you'd have to make your variable " Yearwood" to find all records that have the last name "Yearwood" and no first name.

Further, the third parameter of padr() isn't required in this example. It defaults to a space.

Hope that helps.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform