Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with ==
Message
De
03/07/2002 09:27:15
 
 
À
02/07/2002 09:39:44
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00674353
Message ID:
00674910
Vues:
27
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform