TIP: How To Determine Field Data Type in KM Action

faq
variables

#1

TIP: How To Determine Field Data Type in KM Action

So, how do you know when the input area for an Action is a "Calculation" field, vs. a "Text" field?

In order to perform calculations, you must either be in an Action Calculation field or use the Calculate token (KM Wiki).

Well, when you click in the input area you will see a small indicator in the far right of the field that will be one of the following:

like this:


Action with Text Field

This field expects everything you enter to be explicit text, unless you encode it with the % delimiters, indicating a Token (KM Wiki) of some type.
To perform calculations here, you must use the Calculate token (KM Wiki).

Set Variable to Text action (KM Wiki)

Pretty much anywhere in KM that you can enter a string (aka text), you can also enter a Token, which includes the Variable and Calculate tokens. The Calculate token Token is a way to perform a calculation in a Text field.


Action with Calculation Field

This field expects numbers along with explicit Variable Names (without the % delimiters) or Functions (KM Wiki), or Operators (KM Wiki). It allows you to create a formula, or just enter a simple number.

Set Variable to Calculation action (KM Wiki)


Action with Variable Field

This field expects the actual Variable Name, OR, in some cases, a Variable Token that will evaluate to another Variable Name


I have used the Set Variable to Text (KM Wiki) and Set Variable to Calculation (KM Wiki) Actions in these examples, but this applies to all KM Actions that have a field for input of some data by the user when building the Macro.

If this all seems a bit confusing, then be assured this is often confusing to new KM users, but will soon feel like second nature, or muscle memory, after you have built a few macros. :wink:

For more information, see the KM Wiki:


Questions?