Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with ==
Message
From
03/07/2002 08:26:25
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
02/07/2002 13:39:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00674353
Message ID:
00674894
Views:
24
Hi Cetin,

I've used the suggestion of Gregory and changed the behaviour of the Filter so that 'myVar' is filled with spaces.
This is a improvment to bring the SQL work like the filter, and the filter now brings some meaningfull result (a 10 char field compared with a single char is allways .F., even if the Field looks like 'A ', what was not the best solution anyway).

The solution with the APPEND FROM was in my mind, but one of the most used things is to count the itmes displayed by the filter, i.e.
lcStatement = Some filter statement gathered on a mask or something else
IF EMPTY(lcStatement) THEN
 lcFor   = ''
 lcWhere = ''
ELSE
 lcFor   = lcStatement
 lcWhere = 'WHERE '+lcStatement
ENDIF
SET FILTER TO &lcFor

SELECT *;
 FROM ALIAS();
 TO SCREEN NOCONSOLE;
 &lcWhere

lnRecordsDisplayed = _TALLY &&different from RECCOUNT(), looks for DELETED()
The SELECT is that quick and simple on that, nothing to create or to clean.

Thanks for your help

Agnes

>Then I don't know an easy way. Each and every piece in filter expression would need to be parsed and translated accordingly. Maybe using a udf() might be a shorter solution.
>OTOH if all this is to get a cursor you could mimic it w/o an SQL :
>
>select myTable
>afield(aStruc)
>create cursor crsSQL from array arrStruc
>append from myTable for &lcFilter
>
Cetin
>
>
>
>>Hi Cetin,
>>
>>this depends on the point of view. SET FILTER works perfectly - in his rules, because it depends on FoxPro's nativ operator "==".
>>
>>SELECT SQL defines his own operator "==".
>>
>>There is no problem that something is 'wrong'. It is clearly documented as it is.
>>
>>My problem is how to translate the statement from FILTER() or the statement I put into a SET FILTER in a way that a SELECT SQL produces the same result as the filtered part of the cursor shows.
>>
>>(Or what will do same: How to translate the statement out of SELECT SQL's WHERE clause in a way that SET FILTER TO displays the same result as SELECT SQL?)
>>
>>
>>Agnes
>>
>>>Agnes,
>>>Yes == in SQL is different and shortcut for Set Ansi On. However why should that be a problem :
>>>set filter to myField == myVal
>>>
>>>If myVal is not the same size as the field itself filtering would be selecting no records, something like 'set filter to .f.'
>>>
>>>IOW it's the filter causing problem there not the SQL.
>>>Cetin
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform