Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filter clear
Message
De
18/10/2004 05:41:12
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
17/10/2004 16:23:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00951906
Message ID:
00952218
Vues:
12
Hi Alex

You are fixing the symptom, not the cause.

>In case m.lcBillNo - "N", m.lcDateIn - "D"
>
Local lcFilter
>lcFilter = "BILLNO=" + Transform( m.lcBillNo) + " AND DATEIN=CTOD('" + DTOC( m.lcDateIn) + "')"
>Set Filter To &lcFilter
>In case m.lcBillNo - "C", m.lcDateIn - "D"
>
Local lcFilter
>lcFilter = "BILLNO='" + AllTrim( m.lcBillNo) + "' AND DATEIN=CTOD('" + DTOC( m.lcDateIn) + "')"
>Set Filter To &lcFilter
>and so on...
>

That is the wrong way to fix this problem.

lcBillNo and lcDateIn are character variables. If the user interface provided numeric and date values, you should fix that when the values are put in the variables.

CTOD will prevent the filter from Rushmore Optimizing.
LOCAL m.lnSelect, m.lcOldFilter, m.lcBillNo, m.lcDateIn
m.lnSelect = SELECT()
SELECT mstr
m.lcOldFilter = FILTER()
m.lcBillNo = TRANSFORM(THISFORM.TEXT1.VALUE) && should be THISFORM.txtBillNo.Value

m.lcDateIn = DTOS(THISFORM.TEXT2.VALUE) && should be THISFORM.txtDateIn.Value

m.lcDateIn = "{^" + LEFT(m.lcDateIn,4) + "-" + SUBSTR(m.lcDateIn,5,2) + "-" ;
  + SUBSTR(m.lcDateIn,7,2) + "}"

lcFilter = "BILLNO = " + m.lcBillNo + " AND DATEIN = " + m.lcDateIn

SET FILTER TO &lcFilter.
LOCATE
IF NOT FOUND()
  SET FILTER TO &lcOldFilter.
ENDIF
SELECT (m.lnSelect)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform