i4w_math
Usage
This module is the automated version of the [i4w_math] shortcode and is designed to allow you to query a contact field in your Keap application, perform a simple math operation on it and store the result in Keap.
This module can be called through a 'Send an http post…' following a web or order form.
This module can be called manually by typing the URL in your browser.
This module can be called through a 'Send an http post…' as part of a trigger process, legacy action set or campaign builder sequence.
Parameters
| Parameter | Value | Description |
|---|---|---|
| i4w_math | YOUR_SECURITY_KEY | Specifies the action to perform. |
| field | _FieldName1 | Specifies the name of the field used to perform the operation. |
| target | _FieldName2 | Specifies the name of the field in which to store the results of the operation. If not specified, it defaults to the name provided in "field". |
| value | 234.50 | Specifies the value of the second operand in the operation. If the name of a valid Keap contact field is entered, that value will be used instead. |
| operation | add | Specifies the math operation to be performed. Valid operations are: add, sub (subtract), div (divide), mul (multiply), pow (power), mod (modulus), sqr (square root), max (maximum), min (minimum). |
| round | 2 | Specifies the number of decimal digits to round the result of the operation to. If a positive value is provided the rounding will occur after the decimal point, if a negative value is provided the rounding will occur before the decimal point. Halves are always rounded up. (0, which is the default if this parameter is not defined, means any value will be rounded to an integer). |
| decimals | 0 | Specifies the number of decimals places to store back into Keap (0, which is the default if this parameter is not defined, means any value will be rounded to an integer). |
Example
- Same Field
- Different Field
The value of custom field "_CustomField" will be multiplied by 39.95 and stored back in Keap with 2 decimal after rounding to the hundredth.
https://www.yoursite.com/?i4w_math=YOUR_SECURITY_KEY&field=_CustomField&operation=multiply&value=39.95&round=2&decimals=2
The value of custom field "_CustomField" will be multiplied by 39.95 and stored back in Keap with 2 decimal after rounding to the hundredth and store the result in custom field _OtherCustomField.
https://www.yoursite.com/?i4w_math=YOUR_SECURITY_KEY&field=_CustomField&operation=multiply&value=39.95&round=2&decimals=2&target=_OtherCustomField
Notes
In all examples provided, YOUR_SECURITY_KEY stand for the security key defined under plugin options. These are used to authenticate the request.
The new "Campaign Builder" HTTP POST do not automatically send the contact record data for processing. Individual value pairs must now be specified. In this case, the required value pair is either of the following:
| Parameter | Keap Merge Field |
|---|---|
| Id | ~Contact.Id~ |
| contactId | ~Contact.Id~ |
| ContactId | ~Contact.Id~ |
| Contact0Id | ~Contact.Id~ |
The format of how the value is stored within Keap depends upon the contact field type. Decimal Number, Text and Currency fields will have the data stored by Keap exactly as calculated by this module. However data stored in a Whole Number field type will be rounded up or down automatically by Keap upon storing the data.