Jump to content

Recommended Posts

Posted

With ESP Conditions in templates can you use logical operators such as 'OR' and 'AND', or is just a single value assessment condition?

For example I wish to check if {{Customer Contact.H_language} is 'en' or 'en-US' or is not 'fr' or 'de' or 'pl'?

Cheers

Martyn

Posted

@Martyn Houghton @James Ainsworth the documentation might be a bit unclear. Given that ESP conditions are based on SQL conditions, there is no reason why all valid operators in SQL are not allowed in ESP conditions... I see no reason why AND/OR cannot be used in ESP conditions, they should work fine. The documentation does not explicitly say that only those two operators are allowed. 

The ESP conditions to check the language as you need should be the following:

For en and en-US:

'{{Customer Contact.H_language}' = 'en' OR '{{Customer Contact.H_language}' = 'en-US' 


For not fr, de or pl:

'{{Customer Contact.H_language}' != 'fr' AND '{{Customer Contact.H_language}' != 'de' AND '{{Customer Contact.H_language}' != 'pl'

A more simplified expression (more elegant I would say too) would be the following:

For en and en-US:

'{{Customer Contact.H_language}' IN ('en', 'en-US') 


For not fr, de or pl:

'{{Customer Contact.H_language}' NOT IN ('fr', 'de', 'pl')

 

  • Thanks 2
Posted

@Martyn Houghton template translations... interesting but yeah, we don't have them :) 

On ESP conditions, if you are comparing string values, remember to always enclose the variable into quotes or apostrophes, as in the example... in generic SQL conditions that's not necessary but in ESP conditions it is... 

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...