957
Views
9
Comments
Solved
Like in expressions
Question

Hi Guys


I'm implementing a solution using Like in an expression, but I have the following situation: within my search I can have a value = "Turbo" or "Turbo Tank" and for my condition I want the like to make the difference between these two 

Expression:

ContainerCollectionLocation.Location like % + Location_Input + %

2023-04-16 15-25-31
Krishnanand Pathak
Solution


As I understand, If you have to filter only match result why don't you use inside the filter as shown below.
Regards
Krishnanand Pathak

2021-08-12 05-19-40
Shubham Janbandhu

Hi Fabiano Silva,

Use below condition like this to make difference,

Location_Input like % + ContainerCollectionLocation.Location  + %

Let me know if you need more information.

Regards,

Shubham


UserImage.jpg
Fabiano Silva

In that case it can't find any searchSorry for not sharing the OML, because it's from the company I work for

2021-08-12 05-19-40
Shubham Janbandhu

Can I know where you are using that condition, in Aggregate for filter?

UserImage.jpg
Fabiano Silva




I'm using it in a filter inside an aggregate 

2024-12-10 04-40-04
Gitansh Anand

Hi @Fabiano Silva, like is only available in aggregates and SQL, so if you are trying to achieve this in an aggregate filter or SQL, you are going in the right direction. In case you want it in a normal expression, try the index function (refer to the image below).

Index(ContainerCollectionLocation.Location, Location_Input) <> -1

Thanks
Gitansh Anand

UserImage.jpg
Fabiano Silva

I have a list where I can have valuesTestTest2TestEmailcomboTankhowever, when I put the Test value in the filter input, I want to search only Test, I don't want my search to return Test2, TestEmail

2023-04-16 15-25-31
Krishnanand Pathak
Solution


As I understand, If you have to filter only match result why don't you use inside the filter as shown below.
Regards
Krishnanand Pathak

2024-09-12 02-43-38
Deepsagar Dubey

Hi @Fabiano Silva 

Possibly we can say this is the limitation for Outsystems aggregate because the logic you mentioned can achieve by IN Operator, so according to your business requirement you can use SQL widget and write a select query.

For example - 

SELECT * FROM  {ContainerCollectionLocation} WHERE {ContainerCollectionLocation} .[Location] IN ("Turbo" ,"Turbo Tank" , "value N") 

I hope it'll help you to solve your problem.

Thanks

Deep

2022-02-25 19-42-59
Srinivas K Singadi

Hello Fabiano Silva

To make a distinction between the two values "Turbo" and "Turbo Tank" when using the Like operator in OutSystems, you can modify the expression to include a space character after the search term when searching for "Turbo", like this: 

(ContainerCollectionLocation.Location like '%' + Location_Input + '%' and ContainerCollectionLocation.Location not like '%' + Location_Input + ' Tank%') or (ContainerCollectionLocation.Location like '%' + Location_Input + ' Tank%') 

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