Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF in SQL
Message
 
 
À
25/11/1998 16:19:33
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00160448
Message ID:
00162366
Vues:
21
>>
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform