mbr_compare
Usage
This shortcode determines the content to be included based upon a comparison of any two values using the specified comparison operator.
Parameters
Parameters | Description |
---|---|
value1 | The name of an ActiveCampaign contact field or contact field shortcode, or custom shortcode parameter or a hardcoded value, which will be compared to value2 based on the comparison operator. The available ActiveCampaign contact field names can be found in ActiveMember360, Utilities, Contact Fields. The lower case version of the Perstag should be used as the field name.Defaults: none. Required: yes. |
cmp | The comparison operator, as listed below. Default: none. Required: yes. |
value2 | The name of an ActiveCampaign contact field or contact field shortcode, or custom shortcode parameter or a hardcoded value, which will be compared to value1 based on the comparison operator. The available ActiveCampaign contact field names can be found in ActiveMember360, Utilities, Contact Fields. The lower case version of the Perstag should be used as the field name.Default: none. Required: yes. |
The comparison operators are:
Operation | cmp value | Or | cmp value |
---|---|---|---|
equal | == | or | EQ |
not equal | <> | or | NE |
greater than | > | or | GT |
less than | < | or | LT |
greater than or equal | >= | or | GE |
less than or equal | <= | or | LE |
begins with | ~= | or | BW |
ends with | =~ | or | EW |
contains | ~~ | or | CONTAINS |
Validity
This shortcode is evaluated for any type of visitor.
Conditional Branching
[ELSE_compare] conditional branching is supported.
Nesting
Shortcode nesting is supported:
[mbr_compare1] thru [mbr_compare19]
[ELSE_compare1] thru [ELSE_compare19]
[/mbr_compare1] thru [/mbr_compare19]
Examples
- Example 1
- Example 2
- Example 3
- Example 4
Display the value stored in the ActiveCampaign contact field named first_name for the logged in user preceded by the word "Hello" if that field is not empty. Otherwise display "Hello Friend.":
[mbr_compare value1='[mbr_db_first_name]' cmp='NE' value2='']
Hello [mbr_db_first_name].
[ELSE_compare]
Hello Friend.
[/mbr_compare]
Display the value stored in the ActiveCampaign contact field named counter
for the logged in user prefixing the string is between 1 and 10 inclusive i.e greater than 0 AND less than 11 if that field has a value greater than 0 and less than 10:
[mbr_compare value1='[mb_db_counter]' cmp='GT' value2='0']
[mbr_compare1 value1='[mb_db_counter]' cmp='LT' value2='11']
[mb_db_counter] is between 1 and 10 inclusive i.e greater than 0 AND less than 11
[/mbr_compare1]
[/mbr_compare]
Display It is currently after 8 o'clock. if the current time is after 8 o'clock otherwise display It is currently 8 o'clock or earlier..
Please note that in this example because the shortcode [mbr_date] must be evaluated prior to [mbr_compare] it uses the shortcode delimiters (| |) see ActiveMember360 Shortcodes, Evaluation Order:
[mbr_compare value1='(|mbr_date format="H"|)' cmp='GT' value2='08']
It is currently after 8 o'clock.
[ELSE_compare]
It is currently 8 o'clock or earlier.
[/mbr_compare]
Display the value passed for the parameter nickname
to the custom shortcode where this mbr_compare shortcode is placed preceded by the word "Hello" if the parameter is not empty. Otherwise display "Hello Friend.":
[mbr_compare value1='%%nickname%%' cmp='NE' value2='']
Hello %%nickname%%.
[ELSE_compare]
Hello Friend.
[/mbr_compare]
API
There is currently no ActiveMember360 API function equivalent for this shortcode.