ke Technical Documentation
Tuesday, March 15, 2011 Compare Numbers/Strings
The compare numbers function is used to show or hide content based on the values of a comparison of 2 numbers. The format of the function is as follows:
Function format:
|COMPARE_NUMBERS(number1;number2;val_for_less;val_for_equal;val_for_greater)| , where:
- number1 - can be the value of a numeric field or a hardcoded number
- number2 - the number whith which the comparison takes place (a hardcoded number)
- val_for_less - content to be shown if the number1 is smaller than number2
- val_for_equal - content to be shown if the number1 is equal with number2
- val_for_greater - content to be shown if the number1 is greater than number2
Example:
Field |USER_LEVEL| takes the value of 1:
|COMPARE_NUMBERS(|USER_LEVEL|;2;normal;special;partner)|
- the content displayed is "normal"
- if |USER_LEVEL| takes the value of 2 the content displayed will be "special"
Function variations:
There is a variation of this function for using it multiple times on a page:
|COMPARE_NUMBERS_EX(number1;number2;prefix)|
- number1 - can be the value of a numeric field or a hardcoded number
- number2 - the number whith which the comparison takes place (a hardcoded number)
- prefix - used in the keywords
Available keywords:
- |SHOW_ON_COMPARE_NUMBERS_GREATER_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_GREATER_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_GREATER_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_GREATER_END_prefix|
- |SHOW_ON_COMPARE_NUMBERS_SMALLER_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_SMALLER_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_SMALLER_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_SMALLER_END_prefix|
- |SHOW_ON_COMPARE_NUMBERS_EQUAL_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_EQUAL_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_EQUAL_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_EQUAL_END_prefix|
Example:
|COMPARE_NUMBERS_EX(|USER_LEVEL|;2;LEVEL)|
|SHOW_ON_COMPARE_NUMBERS_GREATER_START_LEVEL|
(content for greater)
|SHOW_ON_COMPARE_NUMBERS_GREATER_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_SMALLER_START_LEVEL|
(content for smaller)
|SHOW_ON_COMPARE_NUMBERS_SMALLER_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_EQUAL_START_LEVEL|
(content for equal)
|SHOW_ON_COMPARE_NUMBERS_EQUAL_END_LEVEL|
|COMPARE_NUMBERS_EX(|USER_GENDER|;2;GENDER)|
|SHOW_ON_COMPARE_NUMBERS_GREATER_START_GENDER|
(content for greater)
|SHOW_ON_COMPARE_NUMBERS_GREATER_END_GENDER|
|SHOW_ON_COMPARE_NUMBERS_SMALLER_START_GENDER|
(content for smaller)
|SHOW_ON_COMPARE_NUMBERS_SMALLER_END_GENDER|
|SHOW_ON_COMPARE_NUMBERS_EQUAL_START_GENDER|
(content for equal)
|SHOW_ON_COMPARE_NUMBERS_EQUAL_END_GENDER|
There are some variations of this function, used exclusively on the start repeat functions from the snippets.
Function used only once inside the snippet:
|COMPARE_NUMBERS_INSIDE(number1;number2;val_for_less;val_for_equal;val_for_greater)|
Example:
|STARTREPEAT_1|
|COMPARE_NUMBERS_EX(|USER_LEVEL|;2;LEVEL)|
|SHOW_ON_COMPARE_NUMBERS_GREATER_START_LEVEL|
(content for greater)
|SHOW_ON_COMPARE_NUMBERS_GREATER_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_SMALLER_START_LEVEL|
(content for smaller)
|SHOW_ON_COMPARE_NUMBERS_SMALLER_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_EQUAL_START_LEVEL|
(content for equal)
|SHOW_ON_COMPARE_NUMBERS_EQUAL_END_LEVEL|
|ENDREPEAT_1|
Funnction used multiple times inside the same snippet:
|COMPARE_NUMBERS_EX_INSIDE(number1;number2;prefix)|
Available keywords:
- |SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_GREATER_INSIDE_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_GREATER_INSIDE_END_prefix|
- |SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_SMALLER_INSIDE_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_SMALLER_INSIDE_END_prefix|
- |SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_START_prefix|
- |SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_END_prefix|
- |HIDE_ON_COMPARE_NUMBERS_EQUAL_INSIDE_START_prefix|
- |HIDE_ON_COMPARE_NUMBERS_EQUAL_INSIDE_END_prefix|
Example for multiple usage of the function in the same snippet:
|STARTREPEAT_1|
|COMPARE_NUMBERS_EX_INSIDE(|USER_LEVEL|;2;LEVEL)|
|SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_START_LEVEL|
(content for greater)
|SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_START_LEVEL|
(content for smaller)
|SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_END_LEVEL|
|SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_START_LEVEL|
(content for equal)
|SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_END_LEVEL|
|COMPARE_NUMBERS_EX_INSIDE(|USER_GENDER|;2;GENDER)|
|SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_START_GENDER|
(content for greater)
|SHOW_ON_COMPARE_NUMBERS_GREATER_INSIDE_END_GENDER|
|SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_START_GENDER|
(content for smaller)
|SHOW_ON_COMPARE_NUMBERS_SMALLER_INSIDE_END_GENDER|
|SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_START_GENDER|
(content for equal)
|SHOW_ON_COMPARE_NUMBERS_EQUAL_INSIDE_END_GENDER|
|ENDREPEAT_1|
The compare string function is used to show or hide content based on the values of a comparison of 2 strings. The format of the function is as follows:
Function format:
|COMPARE_STRINGS(str1;str2;val_for_less;val_for_equal;val_for_greater)|