Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with ==
Message
From
02/07/2002 08:48:00
 
 
To
02/07/2002 08:13:08
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00674353
Message ID:
00674400
Views:
23
Agnes,

Well, I would padr the value the user entered and put the padr'ed into the filter.
You cannot expect the user to know the length of a/every field


Better not use a variable in a filter. If it runs out of scope, you've had it

myval = padr(myval, fsize('NameField'))
myval = '[' + myval + ']'

set filter to NameField == &myval


If you do this, then the filter() is directly usable in a select sql.
Thought that was what you were after ;-)


>Hi Gregory,
>
>I think the problem is in my understanding of UI. ::(
>
>If the user enters 'A' on a 4 char field he gets nothing with the filter even if there is a 'A ' in the table. That's true. Until now I simply let him run into a blank result, because he entered it like that. The initial idea was to reproduce this behaviour.
>
>Maybe not to nice to my users?
>
>Would you prefer to have the PADR() solution everytime, even if there is no need to put it into a SELECT?
>
>Agnes
>
>>Agnes,
>>
>>Cetin is right, the problem is in your filter command
>>
>>pad Myval with spaces to the fieldlength. The Filter == and the sql == then behave the same (for char/memo fields)
>>
>>
>>
>>local myval
>>myval = 'Agnes'
>>
>>myval = padr(myval, fsize('NameField'))
>>
>>set filter to NameField == myVal
>>
>>local lcWhere
>>
>>lcWhere = iif(empty(filter(), '', 'where ' + filter())
>>
>>select * ;
>>  from TheTable ;
>>  &lcWhere
>>
>>
>>
>>>Hi All,
>>>
>>>I ave a Problem with the '==' Operator in the SELECT SQL.
>>>
>>>My problem is, I have somewher a filter that is set like
>>>
>>>SET FILTER TO Field==myVal
>>>
>>>
>>>EXACT is OFF, ANSI is OFF
>>>
>>>Now I need to create a SQL SELECT that holds the same records as the filtered table.
>>>
>>>if I use something like
>>>
>>>lcWhere = IIF(EMPTY(FILTER(),'','WHERE '+FILTER())
>>>SELECT *;
>>> FROM MyTable;
>>> &lcWhere
>>>
>>>
>>>This gives possibly different results because the "==" Operator is differnt for SELECT SQL and any other place.
>>>
>>>So I'm thinking about, but could not find a good solution. Replace '==' with "=" and SET ANSI ON will mix up all original "=" statements.
>>>Using LIKE(MyVal,Filed) works fine - until somebody adds a wildcard to the myVal ...
>>>
>>>I run out on ideas on this.
>>>
>>>Please help me
>>>
>>>Agnes
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform