Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filter clear
Message
From
18/10/2004 05:41:12
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
17/10/2004 16:23:49
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00951906
Message ID:
00952218
Views:
11
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)
Previous
Reply
Map
View

Click here to load this message in the networking platform