[web2py] Re: want to lookup a phone number in a db

2021-10-19 Thread A3
Thanks Jim, Didn't realize that it will retrieve all. Actually the database is not so big at the moment so I don't notice any performance problems. Better try your suggestions before it has grown to big. Cheers - A3 Op dinsdag 19 oktober 2021 om 16:50:13 UTC+2 schreef Jim S: > I don't think thi

[web2py] Re: want to lookup a phone number in a db

2021-10-19 Thread Jim S
I don't think this is a good solution because it is retrieving all the rows from the database and then iterating over them to find a match. Do you have the option of sanitizing a phone number before it is stored in the database? Or, could you create a new 'sanitized' phone number field that yo

[web2py] Re: want to lookup a phone number in a db

2021-10-19 Thread A3
finally I tried: db((db.table.id >0)).select(db.table.phonenumber).find(lambda rw: rw.phonenumber.replace("-","").replace(" ","").replace("(0)","")==caller if rw is not None else None) Initially this gave an error TypeError: 'NoneType' object has no attribute '__getitem__'