Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very complicated index expression
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00605398
Message ID:
00606220
Vues:
25
>Yes, you have to put the whole complicated expression in the Where clause for Rushmore to kick in.

Right, thanks, that's exactly what I tried. Thanks to you and Alexander it's much simpler, than the one, I came to by myself.
>
>>>Maybe you should run select with expression first to see if there're any problems? :)
>>
>>Well, I opened PropMstr file and tested on few records. Seems to be just fine. Interesting, though, how can I now perform select for specific last name? Should I use this whole complicated expression? :) I'll try now for Smith
>>
>>Ok, it worked buitifly!
>>
>>>>>Your expression inserts space in the first position for companies.
>>>>>Here's the my fixed version
Trim(Substr(Owner1, At("=", Owner1)+1, At("=", Owner1+"==",2)-At("=", Owner1)-1)) + ;
>>>>>" " + Left( Owner1, At("=", Owner1) -1)
>>>>>
>>>>>
>>>>Ok, thanks. Now I need to do the same operation of updating each "name" index fith time :)
>>>>
>>>>padr(upper(Trim(Substr(Owner1, At("=", Owner1)+1, At("=", Owner1+"==",2)-At("=", Owner1)-1)) + " " + Left( Owner1, At("=", Owner1) -1)),25)
>>>>
>>>>>>>No problem.
Substr(Owner1, At("=", Owner1)+1, At("=", Owner1+"==",2)-At("=", Owner1)-1) + ;
>>>>>>>	" " + Left( Owner1, At("=", Owner1) -1)
>>>>>>>
>>>>>>
>>>>>>Well, it still inserts too many spaces between last name and first name. I guess, I'll go with, which is almost the same
>>>>>>
>>>>>>?
UPPER(PADR(TRIM(SUBSTR(OWNER1,AT('=',OWNER1)+1,AT('=',OWNER1+'=',2)-AT('=',OWNER1)-1))+ ;
>>>>>>" "+LEFT(OWNER1,AT('=',OWNER1+'=')-1),25))
>>>>>>
>>>>>>Thanks to you and Alexander.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>>
Substr(Owner1, At("=", Owner1)+1, At("=", Owner1+"=",2)-At("=", Owner1)-1) + ;
>>>>>>>>>    Left( Owner1, At("=", Owner1) -1) + ;
>>>>>>>>>    Substr(Owner1, At("=", Owner1+"=",2)+1)
>>>>>>>>>
>>>>>>>>
>>>>>>>>This one didn't work. Owner1 field is 25 char long. For companies I don't want to do any transformation. For names I want to sort by Last Name+1 space + First Name. I want to remove suffix completely...
>>>>>>>>
>>>>>>>>>>Hi everybody,
>>>>>>>>>>
>>>>>>>>>>We store names in this format FirstName Initial(1)=LastName=Suffix (Char 25), e.g.
>>>>>>>>>>James H=Smith=3rd
>>>>>>>>>>Nelson W=Smith, etc.
>>>>>>>>>>
>>>>>>>>>>Here is a current index expression:
>>>>>>>>>>index on ;
>>>>>>>>>>UPPER(PADR(TRIM(SUBSTR(OWNER1,AT("=",OWNER1)+1))+ ;
>>>>>>>>>>IIF(AT("=",OWNER1)>0,LEFT(OWNER1,AT("=",OWNER1)-1),""),25)) ;
>>>>>>>>>>tag name1
>>>>>>>>>>
>>>>>>>>>>However, this index expression doesn't correctly work with names with suffix.
>>>>>>>>>>
>>>>>>>>>>I have separate UDF functions like GetLName, GetFName, however, I don't think it's a good idea to use UDFs in Index expression. So, could you please help me with modifying the current one to properly work with suffixes. Also here is another potential problem, if index expression becomes longer than 255 chars...
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform