Expand my Community achievements bar.

SOLVED

Advanced Code to create a "LIKE" or "IN" condition

Avatar

Level 3

Hi everyone,

I know that to configure manually a where condition inside and activity I can use this code to refer to global viariable:

activity.where[0].condition[1].expr = "@language = '" + vars.lang + "'";

I'm wondering if there's a way to check the value with a LIKE command

for IE: if my vars.lang is "en,de,it" and I'd like to select all the recipient who have @language = "en" or "de" or "it".

Thanks a lot!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hey,

Use below.

vars.langs = "'en','de','it'";

activity.where[0].condition[1].expr = "@language IN ( " + vars.langs  + ")";

This will solve your problem.

View solution in original post

2 Replies

Avatar

Level 1

Hi mate,

Just checking as it wasn't clear from your message; would you want to be able to use the 'included in' or the 'like' operation.

Going off your example I would image you will need the included in operation, if so give the following a try:

     "@language IN ('en', 'de', 'it')"

Good luck!

Avatar

Correct answer by
Level 10

Hey,

Use below.

vars.langs = "'en','de','it'";

activity.where[0].condition[1].expr = "@language IN ( " + vars.langs  + ")";

This will solve your problem.