Martyn Houghton Posted November 7, 2019 Share Posted November 7, 2019 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 Link to comment Share on other sites More sharing options...
James Ainsworth Posted November 11, 2019 Share Posted November 11, 2019 Hi Martyn, According to the documentation you can only use = and != Link to comment Share on other sites More sharing options...
Martyn Houghton Posted November 12, 2019 Author Share Posted November 12, 2019 @James Ainsworth Thanks. This also means you have to us single values and are not able to pass a list of values. Cheers Martyn Link to comment Share on other sites More sharing options...
Victor Posted November 12, 2019 Share Posted November 12, 2019 @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') 2 Link to comment Share on other sites More sharing options...
Martyn Houghton Posted November 12, 2019 Author Share Posted November 12, 2019 @Victor I will give those combinations ago. As you can guess from the examples this is us trying to workaround the lack of having template translations. Cheers Martyn Link to comment Share on other sites More sharing options...
Victor Posted November 12, 2019 Share Posted November 12, 2019 @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... 1 Link to comment Share on other sites More sharing options...
Martyn Houghton Posted November 12, 2019 Author Share Posted November 12, 2019 @Victor Thanks for heads up. Cheers Martyn Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now