Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with filter string
Message
From
19/12/2006 06:18:42
 
 
To
19/12/2006 06:00:09
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01178534
Message ID:
01178808
Views:
16
You nearly answered your own question. You can't alltrim a number! Remove the alltrim from your first line.
SET FILTER TO GCode = thisform.y_GCode .AND. !EMPTY(KCode) .AND. EMPTY(MCode)
Even better is to use a variable instead of the property
lnGcode=thisform.y_GCode
SET FILTER TO GCode = lnGcode .AND. !EMPTY(KCode) .AND. EMPTY(MCode)
>But GCode and y_GCode both are numeric.
>
>>Did you try (note the alltrim and str functions added);
>>
>>
>>     Select Hesab01
>>     SET FILTER TO GCode = ALLTRIM(STR(thisform.y_GCode)) .AND. !EMPTY(KCode) .AND. EMPTY(MCode)
>>     thisform.list2.ControlSource = "Hesab01"
>>     thisform.list2.RowSource = "KName"
>>
>>
>>
>>>Hi all
>>>I have a problem with filter command. when i use from below command in my form
>>>
>>>
>>>     Select Hesab01
>>>     SET FILTER TO GCode = thisform.y_GCode .AND. !EMPTY(KCode) .AND. EMPTY(MCode)
>>>     thisform.list2.ControlSource = "Hesab01"
>>>     thisform.list2.RowSource = "KName"
>>>
>>>
>>>i get not correct filtered records, but if i change it as below
>>>
>>>
>>>     Select Hesab01
>>>     filterStr = "SET FILTER TO GCode = " + ALLTRIM(STR(thisform.y_GCode)) + ;
>>>     " .AND. !EMPTY(KCode) .AND. EMPTY(MCode)"
>>>     &FilterStr
>>>
>>>     thisform.list2.ControlSource = "Hesab01"
>>>     thisform.list2.RowSource = "KName"
>>>
>>>
>>>my list2 filled with right records. i know it is because of GCode = thisform.y_GCode , but why it is wrong?
>>>thanks for your help
Previous
Reply
Map
View

Click here to load this message in the networking platform