[vwnc] Fwd: Search String's comparing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Fwd: Search String's comparing

Juan Pablo Cook
Hi, I don't know how to do this: I have a Collection "listaClientes" and in the window I make an INPUT to search from the list and to show me what Customers name's start with 'C' for example.
Here http://www.compubitweb.com.ar/vwsmalltalk/searchcustomer.png is a screenshot so you can understand better what I'm saying.
In the message of the Button "Seleccionar" I have the following code:

buscarPorButton
 
    | resBusqueda |

    resBusqueda := libreriaCaro listaClientes select:[:cli | cli nombre = buscarPorInput value ].

        clientesLista list: resBusqueda.


This works but the problem is that I have to enter the whole name so this is no good.

What I want to do (but I'm not sure how to do it) is to compare caracther vs caracther so this show me all Customers names starting with 'R'.

I found this message in the PDF Collections guide, ( findString: startingAt: ) but I don't know well.

Thanks a lot, I hope you can help me a little ...


JP Cook


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Cesar Rabak
Juan Pablo Cook escreveu:

> Hi, I don't know how to do this: I have a Collection "listaClientes" and
> in the window I make an INPUT to search from the list and to show me
> what Customers name's start with 'C' for example.
> Here http://www.compubitweb.com.ar/vwsmalltalk/searchcustomer.png is a
> screenshot so you can understand better what I'm saying.
> In the message of the Button "Seleccionar" I have the following code:
>
> buscarPorButton
>  
>     | resBusqueda |
>
>     resBusqueda := libreriaCaro listaClientes select:[:cli | cli nombre
> = buscarPorInput value ].
>
>         clientesLista list: resBusqueda.
>
>
> This works but the problem is that I have to enter the whole name so
> this is no good.
>
> What I want to do (but I'm not sure how to do it) is to compare
> caracther vs caracther so this show me all Customers names starting with
> 'R'.
>
> I found this message in the PDF Collections guide, ( findString:
> startingAt: ) but I don't know well.
>
You've put a button to start the search, so when the user decides to
press it [s]he must have been made the mind on how many characters were
typed for the search start. IIUC, the you want to do searches where the
user puts a substring in the field to left of the button "Buscar" (and I
foresee you'll next have some restrictions on what attribute of
collection item will be searched as I read the set of radio buttons more
at left "Buscar por" where the user will select Nombre (name), Apellido
(surname/family name) and Documento (which I surmise will be some
reference to stored documents in the list). The possible use of the
Seleccionar (select) button seems to be for retrieving the entry that
will return in the text field.

To use the message you cite you'll need to do something like (/caveat
emptor/ untested code):

   resBusqueda := libreriaCaro listaClientes select:[:cli | (cli nombre
findString: (buscarPorInput value) startingAt: 1 ) isZero not ].

With this code if the user puts in your input field "San" and you names
that start with "San" you'll get in a collection resBusqueda (let's say
"Sanmartin", "Santiago", "Santos").

I feel the code above would flow better if the atribute were 'apellido'
but you get the gist of it :-)

HTH

--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Juan Pablo Cook
Cesar Rabak: Thanks A LOT for your good help! This now works 'perfect'. First I don't know why did u put (isZero not) in this message...
Second, as you guess perfectly I want to make like a selection first with the radio buttons. With your code I put this:

buscarPorButton

    | resBusqueda |

    buscarPor value = #nombre
            ifTrue:[resBusqueda := libreriaCaro listaClientes select:[:cli | (cli nombre findString:(buscarPorInput value) startingAt:1) isZero not]].
    buscarPor value = #apellido
            ifTrue:[resBusqueda := libreriaCaro listaClientes select:[:cli | (cli apellido findString:(buscarPorInput value) startingAt:1) isZero not]].
    buscarPor value = #documento
            ifTrue:[resBusqueda := libreriaCaro listaClientes select:[:cli | (cli documento findString:(buscarPorInput value) startingAt:1) isZero not]].
   
        clientesLista list: resBusqueda.

Problems:

< The nombre (name), apellido (surname) works well I think but the documento (ID, passport) don't work good because when he find the number that you put, he shows you but not in a sorted way...
< Another thing I have that, first the window show me the ClientesLista (list) with all the Customers but when I search someone, then when I want to have all the complete list again, It doesn't work. It shows me nothing.
< Do I have to use like a Table to show all the information of the Customers?? Because now I'm using a list...

Thanks a lot, We'are helping me a lot ..


Bye

JP Cook



On Sun, Nov 2, 2008 at 6:19 PM, Cesar Rabak <[hidden email]> wrote:
Juan Pablo Cook escreveu:

Hi, I don't know how to do this: I have a Collection "listaClientes" and in the window I make an INPUT to search from the list and to show me what Customers name's start with 'C' for example.
Here http://www.compubitweb.com.ar/vwsmalltalk/searchcustomer.png is a screenshot so you can understand better what I'm saying.
In the message of the Button "Seleccionar" I have the following code:

buscarPorButton
     | resBusqueda |

   resBusqueda := libreriaCaro listaClientes select:[:cli | cli nombre = buscarPorInput value ].

       clientesLista list: resBusqueda.


This works but the problem is that I have to enter the whole name so this is no good.

What I want to do (but I'm not sure how to do it) is to compare caracther vs caracther so this show me all Customers names starting with 'R'.

I found this message in the PDF Collections guide, ( findString: startingAt: ) but I don't know well.

You've put a button to start the search, so when the user decides to press it [s]he must have been made the mind on how many characters were typed for the search start. IIUC, the you want to do searches where the user puts a substring in the field to left of the button "Buscar" (and I foresee you'll next have some restrictions on what attribute of collection item will be searched as I read the set of radio buttons more at left "Buscar por" where the user will select Nombre (name), Apellido (surname/family name) and Documento (which I surmise will be some reference to stored documents in the list). The possible use of the Seleccionar (select) button seems to be for retrieving the entry that will return in the text field.

To use the message you cite you'll need to do something like (/caveat emptor/ untested code):

 resBusqueda := libreriaCaro listaClientes select:[:cli | (cli nombre findString: (buscarPorInput value) startingAt: 1 ) isZero not ].

With this code if the user puts in your input field "San" and you names that start with "San" you'll get in a collection resBusqueda (let's say "Sanmartin", "Santiago", "Santos").

I feel the code above would flow better if the atribute were 'apellido' but you get the gist of it :-)

HTH

--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Holger Guhl
Hello, Juan Pablo,
The reason why you see nothing in your list may have a very simple
reason. If your input field is empty then your selection block ends up as
        [... (cli nombre findString: '' startingAt: 1) isZero not]
Try it in a workspace: " 'x' findString: '' startingAt: 1 ". The method
#findString:startingAt: always returns 0 if the string argument is the
empty string. With this in mind your selection always evaluates "0
isZero not" and the list obtained with #select: is empty.

The thing with the sort order may also be simple (assuming that I guess
your requirements right):
If you want the result list be sorted according to the aspect you choose
with the radio buttons, then of course you must add the sort command
after retrieving the result list with your #select:. The list cannot
know that you want it sorted in this or this way.
Sorting by document ascending would look like
    | filtered |
    filtered := listaClientes select: [...].
    filtered sortWith: [:cli1 :cli2 | cli1 documento < cli2 documento]

The decision whether to use a table or a list depends on what you want
to show to the user. If you want to show more than the name it is best
to use a table. Of course, you can define a #displayString for your
client objects, compiling lots of data into a string, but I would not
recomment it. Looks ugly and may well be against users' requirements.
Using a DataSetView showing columns for name, first name, id, etc might
be a good choice. The DataSetView also provides built in features for
sorting a column by just clicking on the column header. But before going
for DataSets you should try to finish your first version based on lists.
These are much easier to understand.
Regards

Holger Guhl
--
Senior Consultant * Certified Scrum Master * [hidden email]
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812


Juan Pablo Cook schrieb:

> Cesar Rabak: Thanks A LOT for your good help! This now works
> 'perfect'. First I don't know why did u put (isZero not) in this
> message...
> Second, as you guess perfectly I want to make like a selection first
> with the radio buttons. With your code I put this:
>
> buscarPorButton
>
>     | resBusqueda |
>
>     buscarPor value = #nombre
>             ifTrue:[resBusqueda := libreriaCaro listaClientes
> select:[:cli | (cli nombre findString:(buscarPorInput value)
> startingAt:1) isZero not]].
>     buscarPor value = #apellido
>             ifTrue:[resBusqueda := libreriaCaro listaClientes
> select:[:cli | (cli apellido findString:(buscarPorInput value)
> startingAt:1) isZero not]].
>     buscarPor value = #documento
>             ifTrue:[resBusqueda := libreriaCaro listaClientes
> select:[:cli | (cli documento findString:(buscarPorInput value)
> startingAt:1) isZero not]].
>    
>         clientesLista list: resBusqueda.
>
> Problems:
>
> < The nombre (name), apellido (surname) works well I think but the
> documento (ID, passport) don't work good because when he find the
> number that you put, he shows you but not in a sorted way...
> < Another thing I have that, first the window show me the
> ClientesLista (list) with all the Customers but when I search someone,
> then when I want to have all the complete list again, It doesn't work.
> It shows me nothing.
> < Do I have to use like a Table to show all the information of the
> Customers?? Because now I'm using a list...
>
> Thanks a lot, We'are helping me a lot ..
>
>
> Bye
>
> JP Cook
>
>
>
> On Sun, Nov 2, 2008 at 6:19 PM, Cesar Rabak <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Juan Pablo Cook escreveu:
>
>         Hi, I don't know how to do this: I have a Collection
>         "listaClientes" and in the window I make an INPUT to search
>         from the list and to show me what Customers name's start with
>         'C' for example.
>         Here
>         http://www.compubitweb.com.ar/vwsmalltalk/searchcustomer.png
>         is a screenshot so you can understand better what I'm saying.
>         In the message of the Button "Seleccionar" I have the
>         following code:
>
>         buscarPorButton
>              | resBusqueda |
>
>            resBusqueda := libreriaCaro listaClientes select:[:cli |
>         cli nombre = buscarPorInput value ].
>
>                clientesLista list: resBusqueda.
>
>
>         This works but the problem is that I have to enter the whole
>         name so this is no good.
>
>         What I want to do (but I'm not sure how to do it) is to
>         compare caracther vs caracther so this show me all Customers
>         names starting with 'R'.
>
>         I found this message in the PDF Collections guide, (
>         findString: startingAt: ) but I don't know well.
>
>     You've put a button to start the search, so when the user decides
>     to press it [s]he must have been made the mind on how many
>     characters were typed for the search start. IIUC, the you want to
>     do searches where the user puts a substring in the field to left
>     of the button "Buscar" (and I foresee you'll next have some
>     restrictions on what attribute of collection item will be searched
>     as I read the set of radio buttons more at left "Buscar por" where
>     the user will select Nombre (name), Apellido (surname/family name)
>     and Documento (which I surmise will be some reference to stored
>     documents in the list). The possible use of the Seleccionar
>     (select) button seems to be for retrieving the entry that will
>     return in the text field.
>
>     To use the message you cite you'll need to do something like
>     (/caveat emptor/ untested code):
>
>      resBusqueda := libreriaCaro listaClientes select:[:cli | (cli
>     nombre findString: (buscarPorInput value) startingAt: 1 ) isZero
>     not ].
>
>     With this code if the user puts in your input field "San" and you
>     names that start with "San" you'll get in a collection resBusqueda
>     (let's say "Sanmartin", "Santiago", "Santos").
>
>     I feel the code above would flow better if the atribute were
>     'apellido' but you get the gist of it :-)
>
>     HTH
>
>     --
>     Cesar Rabak
>     GNU/Linux User 52247.
>     Get counted: http://counter.li.org/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Juan Pablo Cook
In reply to this post by Juan Pablo Cook
Hello Everybody!! Thanks a lot for your hands...
I put this code finally:

buscarPorButton
   
    | resBusqueda |
    buscarPorInput value = ''
    ifTrue:[resBusqueda := libreriaCaro listaClientes]
    ifFalse:[resBusqueda := libreriaCaro listaClientes
        select:
            [:cli |     
            ((cli perform: buscarPor value)
                findString: buscarPorInput value
                startingAt: 1) isZero not]].   

    clientesLista list: resBusqueda.

and now it works good I think.

I have another idea but I don't know if it is possible:
             I want don't to have a BUSCAR Button Action... only when the user enter a key in the Input entry the list the result of the search appear because is more beautiful I think. When it's erased the field, the list below It's updated with all the Custumers. Do u understand me?
I think this could be using an event of the Input widget that take the "onKeyPress"event; but I didn't find anyone.

Thanks again for your help...

PD: Next, I will like to move the List to DataSetViews like Holger says because I have like 10 "atributes" of each Customer.

Bye


2008/11/3 Cesar Rabak <[hidden email]>
Juan Pablo Cook escreveu:

Cesar Rabak: Thanks A LOT for your good help! This now works 'perfect'. First I don't know why did u put (isZero not) in this message...
Second, as you guess perfectly I want to make like a selection first with the radio buttons. With your code I put this:

Estimado Pablo,

La explanación de Holger con respecto a (isZero not) puede parecer "lacónica", por eso te aclaro:

El mensaje findString:startingAt: tiene como retorno el index de la (sub)cadena buscada, o sea puedes tener el número 1 a el tamaño de la string que se busca.

Cuando no hay "match" el método retorna cero, por eso el teste para estar seguro que vengan solo los elementos que hubo "matching".

Eso trae la oportunidad para que veas si el método queda robusto como está pues es posible que uno ponga 'vill' buscando a alguno Villarroel y puede ser que haya alguno Sevilla venga como respuesta (claro que el "error" se debe en gran parte al hecho que el usuario escribió la 'v' con minúsculas...

HTH y saludos,


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Cesar Rabak
 > Hello Everybody!! Thanks a lot for your hands...
 > I put this code finally:
 >
 > buscarPorButton
 >
 >     | resBusqueda |
 >     buscarPorInput value = ''
 >     ifTrue:[resBusqueda := libreriaCaro listaClientes]
 >     ifFalse:[resBusqueda := libreriaCaro listaClientes
 >         select:
 >             [:cli |
 >             ((cli perform: buscarPor value)
 >                 findString: buscarPorInput value
 >                 startingAt: 1) isZero not]].
 >
 >     clientesLista list: resBusqueda.
 >
 > and now it works good I think.
[snipped]

Another suggestion for you (comes from Code Critic "Assignment to same
variable at the end of ifTrue:ifFalse: blocks"), change your code to:

buscarPorButton

     | resBusqueda |
     resBusqueda := buscarPorInput value = ''
     ifTrue: [libreriaCaro listaClientes]
     ifFalse: [libreriaCaro listaClientes
         select:
             [:cli |
             ((cli perform: buscarPor value)
                 findString: buscarPorInput value
                 startingAt: 1) isZero not]].

     clientesLista list: resBusqueda.


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Boris Popov, DeepCove Labs (SNN)
You could also make your search case-insensitive with something like,

(cli perform: buscarPor value)
  matchesRegexIgnoringCase: '.*' , buscarPorInput value , '.*'

You will need to load Regex parcel for this to work.

Cheers,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Cesar Rabak
Sent: Tuesday, November 04, 2008 11:33 AM
To: Juan Pablo Cook
Cc: [hidden email]
Subject: Re: [vwnc] Fwd: Search String's comparing

 > Hello Everybody!! Thanks a lot for your hands...
 > I put this code finally:
 >
 > buscarPorButton
 >
 >     | resBusqueda |
 >     buscarPorInput value = ''
 >     ifTrue:[resBusqueda := libreriaCaro listaClientes]
 >     ifFalse:[resBusqueda := libreriaCaro listaClientes
 >         select:
 >             [:cli |
 >             ((cli perform: buscarPor value)
 >                 findString: buscarPorInput value
 >                 startingAt: 1) isZero not]].
 >
 >     clientesLista list: resBusqueda.
 >
 > and now it works good I think.
[snipped]

Another suggestion for you (comes from Code Critic "Assignment to same
variable at the end of ifTrue:ifFalse: blocks"), change your code to:

buscarPorButton

     | resBusqueda |
     resBusqueda := buscarPorInput value = ''
     ifTrue: [libreriaCaro listaClientes]
     ifFalse: [libreriaCaro listaClientes
         select:
             [:cli |
             ((cli perform: buscarPor value)
                 findString: buscarPorInput value
                 startingAt: 1) isZero not]].

     clientesLista list: resBusqueda.


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Cesar Rabak
Boris Popov escreveu:
> You could also make your search case-insensitive with something like,
>
>
> (cli perform: buscarPor value) matchesRegexIgnoringCase: '.*' ,
> buscarPorInput value , '.*'
>
> You will need to load Regex parcel for this to work.
>
Yep, but then the issue I mentioned¹ elsewhere in the thread some search
entries will come from any part of the name or surname.

In case Regex be used I _think_ a better matching pattern would be
something like '^[A-Z][a-z]+'², don't you think?


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

[1] it is in Spanish :-|

[2] I write 'something like' because the "right" re would come only
after some design: some surnames like McArthur would not be matched by
my naive example :-o
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Juan Pablo Cook
Hello!!! Thanks again... I changed the code again and It works perfect.
I was wondering how to do that of the Events of Input entry but I don't understand how to do it well...
I read GUIDEvGuide 3-32 but I'm not understand the "controllers" and all that stuff.
In the "Action On" Tab I have four events, In the ´Entry´ or in the ´change´ do I have to put the message? How do I code this notifications?? Do u could show me a bit??

Bye!!!

JP Cook



For further info, look at GUIDEvGuide 3-32.
On Tue, Nov 4, 2008 at 6:18 PM, Cesar Rabak <[hidden email]> wrote:
Boris Popov escreveu:

You could also make your search case-insensitive with something like,


(cli perform: buscarPor value) matchesRegexIgnoringCase: '.*' ,
buscarPorInput value , '.*'

You will need to load Regex parcel for this to work.

Yep, but then the issue I mentioned¹ elsewhere in the thread some search entries will come from any part of the name or surname.

In case Regex be used I _think_ a better matching pattern would be something like '^[A-Z][a-z]+'², don't you think?



--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

[1] it is in Spanish :-|

[2] I write 'something like' because the "right" re would come only after some design: some surnames like McArthur would not be matched by my naive example :-o


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

James Robertson-7
See:



In general, you might want to visit here:



James Robertson
Cincom Smalltalk Product Evangelist
Talk Small and Carry a Big Class Library




On Nov 6, 2008, at 8:29 AM, Juan Pablo Cook wrote:

Hello!!! Thanks again... I changed the code again and It works perfect.
I was wondering how to do that of the Events of Input entry but I don't understand how to do it well...
I read GUIDEvGuide 3-32 but I'm not understand the "controllers" and all that stuff.
In the "Action On" Tab I have four events, In the ´Entry´ or in the ´change´ do I have to put the message? How do I code this notifications?? Do u could show me a bit??

Bye!!!

JP Cook



For further info, look at GUIDEvGuide 3-32.
On Tue, Nov 4, 2008 at 6:18 PM, Cesar Rabak <[hidden email]> wrote:
Boris Popov escreveu:

You could also make your search case-insensitive with something like,


(cli perform: buscarPor value) matchesRegexIgnoringCase: '.*' ,
buscarPorInput value , '.*'

You will need to load Regex parcel for this to work.

Yep, but then the issue I mentioned¹ elsewhere in the thread some search entries will come from any part of the name or surname.

In case Regex be used I _think_ a better matching pattern would be something like '^[A-Z][a-z]+'², don't you think?



--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

[1] it is in Spanish :-|

[2] I write 'something like' because the "right" re would come only after some design: some surnames like McArthur would not be matched by my naive example :-o

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Juan Pablo Cook
Thanks, I saw the  Keyboard Handling video and It's great but I don't understand how to do it well...

JP Cook

On Thu, Nov 6, 2008 at 12:46 PM, James Robertson <[hidden email]> wrote:
See:



In general, you might want to visit here:



James Robertson
Cincom Smalltalk Product Evangelist
Talk Small and Carry a Big Class Library




On Nov 6, 2008, at 8:29 AM, Juan Pablo Cook wrote:

Hello!!! Thanks again... I changed the code again and It works perfect.
I was wondering how to do that of the Events of Input entry but I don't understand how to do it well...
I read GUIDEvGuide 3-32 but I'm not understand the "controllers" and all that stuff.
In the "Action On" Tab I have four events, In the ´Entry´ or in the ´change´ do I have to put the message? How do I code this notifications?? Do u could show me a bit??

Bye!!!

JP Cook



For further info, look at GUIDEvGuide 3-32.
On Tue, Nov 4, 2008 at 6:18 PM, Cesar Rabak <[hidden email]> wrote:
Boris Popov escreveu:

You could also make your search case-insensitive with something like,


(cli perform: buscarPor value) matchesRegexIgnoringCase: '.*' ,
buscarPorInput value , '.*'

You will need to load Regex parcel for this to work.

Yep, but then the issue I mentioned¹ elsewhere in the thread some search entries will come from any part of the name or surname.

In case Regex be used I _think_ a better matching pattern would be something like '^[A-Z][a-z]+'², don't you think?



--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

[1] it is in Spanish :-|

[2] I write 'something like' because the "right" re would come only after some design: some surnames like McArthur would not be matched by my naive example :-o

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Juan Pablo Cook
Hi, I finally have this code:

buscarPorButton

     | resBusqueda |
     buscarPorInput value = ''
     ifTrue:[resBusqueda := libreriaCaro listaClientes]
     ifFalse:[resBusqueda := libreriaCaro listaClientes
         select:
             [:cli |
             ((cli perform: buscarPor value)
                 findString: buscarPorInput value
                 startingAt: 1) isZero not]].

     clientesLista list: resBusqueda.

This works, but I want to be case-sensitive, how can I do that?

Thanks
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Reinout Heeck-2
Juan Pablo Cook wrote:

> Hi, I finally have this code:
>
> buscarPorButton
>
>      | resBusqueda |
>      buscarPorInput value = ''
>      ifTrue:[resBusqueda := libreriaCaro listaClientes]
>      ifFalse:[resBusqueda := libreriaCaro listaClientes
>          select:
>              [:cli |
>              ((cli perform: buscarPor value)
>                  findString: buscarPorInput value
>                  startingAt: 1) isZero not]].
>
>      clientesLista list: resBusqueda.
>
> This works, but I want to be case-sensitive, how can I do that?
>  

See the implementers of #sameAs:.
You might also be interested in #match:.



R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Fwd: Search String's comparing

Cesar Rabak
In reply to this post by Juan Pablo Cook
Juan Pablo Cook escreveu:

> Hi, I finally have this code:
>
> buscarPorButton
>
>      | resBusqueda |
>      buscarPorInput value = ''
>      ifTrue:[resBusqueda := libreriaCaro listaClientes]
>      ifFalse:[resBusqueda := libreriaCaro listaClientes
>          select:
>              [:cli |
>              ((cli perform: buscarPor value)
>                  findString: buscarPorInput value
>                  startingAt: 1) isZero not]].
>
>      clientesLista list: resBusqueda.
>
> This works, but I want to be case-sensitive, how can I do that?
>
Try this (untested) code instead:

buscarPorButton

      | resBusqueda |
      buscarPorInput value = ''
      ifTrue:[resBusqueda := libreriaCaro listaClientes]
      ifFalse:[resBusqueda := libreriaCaro listaClientes
          select:
              [:cli |
              ((cli perform: buscarPor value)
                  findString: buscarPorInput value
                  startingAt: 1 ignoreCase: false useWildcards: false)
isZero not]].

      clientesLista list: resBusqueda.


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc