Automation Action: Counter
Update a counter value.
Update a counter value for any name/value pair and optional period.
This action can be used to update a counter value that is stored by the ThinkAutomation Server. After updating the counter the new counter value can be returned to a variable.
Enter the Counter Name. The name is limited to 50 characters and will be truncated if longer.
Enter the Counted Value. This entry is optional. If a Value is specified then a separate counter will be maintained for each unique name/value pair. The Value can contain %variable% replacements.
Counters are shared within a Solution. So if a counter on two Automations within the same Solution update the same name/value pair then the same counter will be used.
Period
Counters can be maintained per :
Period | Details |
---|---|
Static | No period |
Day | The month day number (1-31) |
Day Of Week | The day of week (0-6, 0=Sunday, 1=Monday etc) |
Year And Month | The year and month (2022 01, 2021 02 etc) |
Year | The year |
Month | The month number (1-12) |
Year And Week Number | The year and week number (0-52) (Iso8601) |
Hour | The hour (0-23) |
Minute | The minute (0-59) |
The period date is based on the message date %Msg_Date%
If a period is selected then a new counter is created for each unique period. A Static counter has no period.
Operation
You can Increment, Decrement, Get or Set a counter. If Set is selected then you can specify a value.
When a message is processed, ThinkAutomation will lookup the unique name/value pair. A new counter will be created if the name/value pair does not exist.
Any arbitrary data can be counted. For example:
Aim | Usage |
---|---|
Messages by day of week | Leave Value blank and set the Period to Day Of Week. |
Messages received by email address per year/month | Set the Value to %Msg_FromEmail% and the Period to Year And Month. |
Messages by any extracted field or variable value (payment types, currencies etc) | Set the Value to a %variable% and any select a Period. |
Orders by company name per year | Set the Value to a %variable% holding a company name and the Period to Year. |
Outgoing emails sent by email address per month | Set the Value to the variable containing the receiver address and the Period to month. |
The counted Value has a maximum size of 250 characters. Values larger than this will be truncated before being counted.
Select a variable to receive the updated counter value from the Assign Counter Value To list.
Getting All Counter Values
You can return all counter values for a given counter name/value using the Get All operation. This will return all periods currently counted. The Get All operation returns the data in CSV format to a variable. If no Value is specified then all values/periods will be returned.
You can use the Set Variable action with the Convert CSV To Markdown Table operation to convert the CSV data to a Markdown table if you want to create an Automation to quickly return and view counter values.
Viewing Counters Using The Studio
Counters can be viewed using the ThinkAutomation Studio. Open the Solution properties page and click the Counters tab. You can clear a counter using the Clear button.