Agnes,
Seeing that you are still working on it another thing comes to my mind re the filter
- You can use the filter() in the where of an SQL
- you can disregard the fieldsize as it works with like('abc*', field)
- the advantage is that if the user enters eg 'AB' he will get everything that starts with AB (ABc, ABdeg, AB, ...)
maybe the users will prefer that
eg user enters in a textbox I assume some value
MyVal = SomeTextbox.Value
local f
f = 'Like([' + rtrim(MyVal) + '*], ' + FieldName + ')'
select TheTable
set Filter to &f
lcWhere = iif(empty(Filter), '', 'Where ' + Filter())
select * ;
from TheTable ;
&lcWhere
>Hi Gregory,
>I will pay attention to this and redesign the method.
>I agree on not using vars directly (it was only as an example).
>
>Now I have to to think where to get the fieldlenght from, because the filter box is an abstract one and there need no data to be in scope or even open in the moment of setting the values. It will bring a lot of fun to my colaborators to set fieldlenght to a property on each character filter ...
>
>
>Thank you and Cetin for fast help.
>
>Agnes
>
>>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 ;-)
>>
>>
Gregory