Search on integer fields

QuestionsSearch on integer fields
Matt Shaw asked 3 years ago

By default, Search seems to assume columns are TEXT, by using lower(<fieldname>) in the search query.  But I have integer fields, such as Year and various ID columns that I want to be searchable.  Instead, we get an error:

Couldn’t execute query. ERROR: function lower(integer) does not exist LINE 1: …ation from xxx WHERE 1=1 AND ( LOWER(“year”)…

Do I need cast everything as text?  Or is there a better way?

 

1 Answers
Abu Ghufran Staff answered 3 years ago

Hi,

This is used only with the databases (oracle, db2, postgres) which does not perform case insensitive searches in string.

The cast() solution will also work. You can also fix the search operator to equals in case of numeric (and avoid contains search):

$col["searchoptions"]["sopt"] = array("eq");
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

13 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?