KeyValuePair

 

 

 

KeyValuePair

 

Description

Provides read and write access to key/value pairs that can be defined at various levels within the development hierarchy.  These are useful for persisting simple values such as auto-incrementing counters, statistics, or simple data values that need to be persisted between job executions.

 

Arguments

1.KeyValuePair - Name of the Macro.

2.Action - The action to take.  Can be either Get, Set, or Increment.

3.Scope - The level at which to create/read/write from.  Valid values are System, Account, Agent, Job, and Impeller.

4.Key - The unique key name for the key/value pair used at the scope level.

5.Value - The value that is written for Set operations or serves as the default value if the macro command is creating the key value pair on first access.

 

Examples

<KeyValuePair|Increment|Job|Counter|0>

Reads a key value pair defined at the job scope for the currently executing context (or creates it with a default value of 0 if it does not already exist), increments the value, and returns the new value.

 

<KeyValuePair|Get|Agent|LastBatch>

Reads a key value pair defined at the agent scope for the currently executing context (or creates it with a default value of blank if it does not already exist) and returns the new value.

 

<KeyValuePair|Set|System|LastBatch|<DateTime>>

Creates or updates a key value pair defined at the system scope for the currently executing context with the current date and time as a value and returns the new value.

 

Notes

This macro command is rare in that it has the ability to do more than just parse string but actually make persistent changes to the database.  In all scenarios the macro command will emit the result of the Get, Set, or Increment command but this can be suppressed by wrapping the command in the Blank macro.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.