265
Views
12
Comments
Solved
multiple search criteria aggregates or sql

Hi Team,

I want to filter the result in aggregates based on the search criteria.

User can enter either custName or age

If I add single filter ,It s is working,But With age criteria addition it is not working,Age is an integer ,I have tried texttoInteger(Customer.Age) ,But its is not filtering ,want to enter either of conditions as filter

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" 

Thank you

2026-01-15 03-18-59
Vijay Malviya
Solution

Hi,

you can try this option also

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or  Index(Customer.Age, SearchKeyword)<>-1
2020-11-13 07-48-15
Khuong Truong
Solution

Hi,

I updated the filter. Please take a look at my updated .oml

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or IntegerToText(Customer.Age) = SearchKeyword 

Cheers,

Khuong

Customer.oml
2020-11-13 07-48-15
Khuong Truong

Hi,

You can try as follow: 

PS: Please notice that for age this search exact age. 

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or Customer.Age = TextToInteger(SearchKeyword)
2020-11-13 07-48-15
Khuong Truong

Hi,

If you want to use "like" for filter age, please use this:

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or IntegerToText(Customer.Age) like "%" + SearchKeyword + "%"
UserImage.jpg
ujwala

Than you ,But if I enter with age as "30" it works with below condition ,But if i enter name as "uj" in search keyword ,It gives error as can not be converted into int

2020-11-13 07-48-15
Khuong Truong

Hi,

Please test in your screen.

Here is my sample.

Cheers,

Khuong

UserImage.jpg
ujwala
Customer.oml
2020-11-13 07-48-15
Khuong Truong
Solution

Hi,

I updated the filter. Please take a look at my updated .oml

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or IntegerToText(Customer.Age) = SearchKeyword 

Cheers,

Khuong

Customer.oml
UserImage.jpg
ujwala

Thank you Khuong,

It is working now,not sure why not worked for texttoInteger on searchkeyword(Reverseway)


Thank you

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi ujwala,

the reason is visible in your earlier screenprint : it can't convert a string to an integer.

your were just doing a TextToInteger on any text typed, so of course he will fail if you test with a non-numeric search string.

Dorine

2020-11-13 07-48-15
Khuong Truong

Hi Ujwala,

As Dorine has expained above and as you can see the description of TextToInteger function when using in Aggregate it will throws an exception of value is outside the boundaties of Integer values.

If you want to use it, can add TextToIntegerValidate as the description suggestion.

Here is the updated filter:

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or If(TextToIntegerValidate(SearchKeyword), Customer.Age = TextToInteger(SearchKeyword), False)

Hope this clear for you,

Khuong

UserImage.jpg
ujwala

Thank you Khuong for clarification.

2026-01-15 03-18-59
Vijay Malviya
Solution

Hi,

you can try this option also

SearchKeyword="" or Customer.CustName like "%" + SearchKeyword + "%" or  Index(Customer.Age, SearchKeyword)<>-1
2026-01-15 03-18-59
Vijay Malviya

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.