RMC "emswitch" module

RMC system allows use of conditions according to some system values with a notation in html content. This notation has named as emswitch, and with use of this system will produce different html contents for each member according to their demographic information.

The syntax is mainly like this:
<%emswitch%>
emcase:(demografic_value_of_member_1 operator_1 value_1)
{
  Content1
}
emcase:(demografic_value_of_member_2 operator_2 demografic_value_2)
{
  Content2
}
emcaseelse
{
Content3
}
<%endemswitch%>
The notation starts with <%EMSWITCH%> and ends with <%ENDEMSWITCH%> keyword. You can use more than one emswitch area in an html.


In a <%EMSWITCH%> area you can use different conditions. A condition starts with EMCASE: syntax, then condition must be defined in brackets, if a condition is true system will use html or text block in those brackets.  System always look for one match in the conditions and uses content of first true condition and than exists from that emswitch area. If none of the conditions are true than you can use content with a EMCASEELSE keyword.

emswitch module allows you to use different operators in emcase conditions. These operators are =>, < and <>.

  • = operator returns true, if two values are equal. This operator works for both string and integer values.
  • > operator returns true if first value is greater than the second one. This operator works only for integer values.
  • < operator returns true if first value is less than the second one. This operator works only for integer values.
  • <> operator returns true, if two values are not equal. This operator works for both string and integer values.


In an emcase condition you can use more than one comparision areas and execute these comparisons with “and”, “or” keywords.

Here is an example with the use of all supported features
<%emswitch%>
emcase:(23<>23)
{
 content1
}
emcase:(22=27)
{
content2
}
emcase:(33<>33)
{
 content3
}
emcaseelse
{
 content4
}
<%endemswitch%>
some html or text here...
<%emswitch%>
emcase:(23=22 and 35=35)
{
content5
}
emcase:(23=22 or 35=35)
{
content6
}
emcaseelse
{
 content8
}
<%endemswitch%>
<%emswitch%>
emcase:('text' <> 'text')
{
content10
}
emcaseelse
{
 content11
}
<%endemswitch%>
The output html after rendering will look like this:

content4

<some html here...>

content6

content11

Another example about emswitch, with RMC demographic field notation.
<%emswitch%>
emcase:('<##city##>' = 'istanbul')
{
 content about istanbul
}
emcase:('<##city##>' = 'ankara')
{
content about ankara
}
emcaseelse
{
content for all cities
}
<%endemswitch%>

Here system will render and produce html output for all members according to their city information.

An important point about emswitch module is that you do not need to seperate whole html in the emcase areas. Only the different content between conditions should be used in the emcase fields.

Copyright 2020 Related Digital