Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDF in SQL
Message
De
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:
00161597
Vues:
28
>
>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)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform