Skip to main content
Level 2
Jul 2, 2025 6:48 AM UTC
Solved

Contains in query def expression

Hi Team,
Im trying below expression in query def  I actually want to try using  contains instead of like

Iif(@label LIKE '%labelname1%' OR @2449631 LIKE '%labelname2%','A1' ,Iif(@label LIKE '%labelname3%' OR @2449631 LIKE '%labelname4%','A2','A3' ) )

Could you please help us with correct syntax.

 

ParthaSarathy
ParthaSarathyAccepted solution
New Participant
Jul 2, 2025 7:09 PM UTC

Hi @vanivi1 ,

You can utilize the 'Charindex' function in expression as below:

 

Iif(Charindex(@label, 'labelname1') > 0 OR Charindex(@label, 'labelname2') > 0,'A1' ,Iif(Charindex(@label, 'labelname3') > 0 OR Charindex(@label, 'labelname4') > 0,'A2','A3' ) )

 

The above expression will result the value 'A1' if the label contains 'labelname1' or 'labelname2' and the result will be 'A2' if the label contains 'labelname3' or 'labelname4'. For all the other labels, 'A3' will be the default value.

 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups

3 replies

Marcel_Szimonisz
New Participant
Jul 9, 2025 7:04 AM UTC

Hello @vanivi1,

why like cannot be used?

LIKE %xyz% == contains

 

Marcel

Translate
ParthaSarathy
ParthaSarathyAccepted solution
New Participant
Jul 2, 2025 7:09 PM UTC

Hi @vanivi1 ,

You can utilize the 'Charindex' function in expression as below:

 

Iif(Charindex(@label, 'labelname1') > 0 OR Charindex(@label, 'labelname2') > 0,'A1' ,Iif(Charindex(@label, 'labelname3') > 0 OR Charindex(@label, 'labelname4') > 0,'A2','A3' ) )

 

The above expression will result the value 'A1' if the label contains 'labelname1' or 'labelname2' and the result will be 'A2' if the label contains 'labelname3' or 'labelname4'. For all the other labels, 'A3' will be the default value.

Translate
 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
Jul 2, 2025 9:27 AM UTC

Hi @vanivi1 

Assuming you are running Oracle database, this syntax should work:

 

CONTAINS(<fieldName>, <fieldValue>) > 0;

 

BR, Oscar

Translate