Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF in SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00160448
Message ID:
00162372
Vues:
25
>>>
>>>LPARAMETERS lcToMatch, lcChoice1, lcChoice2, lcChoice3, lcAnswer1, lcAnswer2, lcAnswer3
>>>
>>>DO CASE
>>> CASE lcToMatch = lcChoice1
>>> RETURN lcAnswer1
>>> CASE lcToMatch = lcChoice2
>>> RETURN lcAnswer2
>>> CASE lcToMatch = lcChoice3
>>> RETURN lcAnswer3
>>
>> Otherwise
>> Return space(10)
>>
>>>ENDCASE
>>>
>>>
>>>Right now the table is small, but it has the potential to have thousands of records. Do you know a better way of replacing the abbreviations with the full words?
>>
>>Here's a quick'n'dirty. Haven't actually checked, but I remember having done things like this already, and they worked. It's essential that the spaces in "CXLNR NS " stay as they are, so the AT() returns 1,4 or 7.
>>
>>
>>dime aStatTxt[3]
>>aStatTxt[1]="Canceled"
>>aStatTxt[2]="Not Ready"
>>aStatTxt[3]="No Show"
>>
>>SELECT cname, tdatetime, ;
>> IIF(EMPTY(cPickup), cPaddr, cPickup) AS cPickup, ;
>> IIF(EMPTY(cDropoff), cDaddr, cDropoff) AS cDropoff, ;
>> int(at(cStatus, "CXLNR NS ")+2)/3) AS nstatus ;
>> space(12) as cStatusText ;
>> FROM Trip_History ;
>> INTO CURSOR ro_trips ;
>> WHERE (INLIST(cStatus, "CXL", "NR", "NS")) AND BETWEEN(TTOD(tdatetime), pdBegin, pdEnd) ;
>> ORDER BY nStatus, tdatetime
>> use (dbf()) alias vTrips in 0 again
>> sele vTrips
>> repl all cStatusText with aStatTxt[nStatus] for betw(nstatus,1,3)
>>
>
>With that use again trick, do you have to use "(dbf())"? I tried "USE oldtable ALIAS newtable IN 0 AGAIN" and it didn't work.
>
>Thanks,
>
>-Michelle

You have to use DBF() function to use real DBF name of the cursor.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform