Applying Additional Conditions with Calculated Dues
When entering a ranged calculated dues rates or step and increment calculated dues rates, notice a Condition field beneath the required fields of Low Range and High Range rate and Step and Increment.
Using the Condition field, use Boolean logic to enter and evaluate conditions to dues rates. For example, using the Boolean logic below in the Condition field, check to make sure that any organization purchasing the membership also resides in the United States:
=((if ( ({adr_country}=="US") || ({adr_country}=="United States") || ({adr_country}=="USA") || ({adr_country}=="United States Of America") ) then 1 else 0 endif) )
If the organization evaluated to false and it does not have a country code of the United States, the default dues rate would be assessed – unless there is an additional dues rate set-up to evaluate for additional country codes.
Note the following about the logic that is used in Condition fields:
- Boolean logic is used in that the double pipe || is used for OR, a 1 signifies the entire statement has evaluated to true while a 0 means the entire statement has evaluated to false. Boolean logic is also used in that all of the conditions used in the statement must evaluate to true for the entire statement to be true. Further, if even one of the conditions in the statement above evaluates to false, the entire statement is false. There are several Boolean logic tutorials on the Web.
- If you decide to use a value such as a country code, make sure you check for all the possible country codes that may be entered (or selected) in the system. Obtain these from the Data Import Workbook and then check for them using an if, then, else statement combined with Boolean logic such as used in the example above. When setting-up calculated dues the data base fields must be enclosed in braces {}.
- Each statement that is evaluated must be enclosed in parentheses and the value being checked must be enclosed in quotes. It is easier to begin crafting a condition statement from the inside out to make sure all parentheses are in place.
- Each condition field statement begins with an equal sign.
- A staff member well-versed in coding and/or logic would be better at entering conditions as these can cause unexpected results if entered incorrectly. An incorrect condition statement will cause calculated a Dues Rate to fail and will no longer calculate the Dues Rate in the Shopping Cart, and will place a N/A in the rate column.