# Calculated Field

The Calculated Field Transformation enables a user to create new column values by applying expressions, the result of which can be a newly defined column or it can replace the value in an existing one.

For example, the Agent could convert a temperature attribute on the incoming payload from Celsius to Fahrenheit - and either replace the temperature value or add a new attribute to the outgoing payload.

Statements can be written using a subset of the C# syntax. Refer to the example section for [sample expressions](https://xmpro.gitbook.io/integrations/calculated-field/how-to-use/example#example-expressions) and [supported operations](https://xmpro.gitbook.io/integrations/calculated-field/how-to-use/example#supported-operators).

Details for an [example](https://xmpro.gitbook.io/integrations/calculated-field/how-to-use/example) and its [configuration](https://xmpro.gitbook.io/integrations/calculated-field/how-to-use/configuration#configuration) can be found in the *How to Use* section.

## Pre-requisites

None at this time

## Limitations

Not every C# syntax is supported. Here are some examples of NOT supported features:

* Multiline expressions
* for/foreach/while/do operators
* Array/list/dictionary initialization
* Explicit generic invocation (like `method<type>(arg)`)
* Lambda/delegate declaration (delegate and lamda are only supported as variables or parameters or as a return type of the expression)
* Array/list/dictionary element assignment (set indexer operator)
* Other operations on `dynamic` objects (only property, method invocation, and index now are supported)

## Current Version

* [Download](https://xmappstore.blob.core.windows.net/tier6/Transformation_Calculated%20Field_v4.00.xmp) the Calculated Field Transformation v4.00 (Last Update: 17 Mar 2026)

Please [contact](mailto:support@xmpro.com?subject=calculated-field-older-version) XMPro if you're looking for an older version of this Agent.

## Release Notes

<table><thead><tr><th width="104">Version</th><th width="132">Date</th><th>Description</th></tr></thead><tbody><tr><td>v4.00</td><td>17 Mar 2026</td><td>Support <a href="https://documentation.xmpro.com/4.6/src/concepts/agent/event-level-streaming-vs-agent-level-streaming.html">Event-Level Streaming</a> (when using XMPro Platform v4.6+) for reduced memory usage and earlier downstream processing.</td></tr><tr><td>v3.46</td><td>27 Aug 2024</td><td>Support an option to process records separately so that an error doesn't stop the execution of a batch.</td></tr><tr><td>v3.45</td><td>10 Apr 2024</td><td><p>Downgraded Newtonsoft.Json to v11.0.1.</p><p>Backward compatible with older Stream Host versions.</p></td></tr><tr><td>v3.44</td><td>29 Feb 2024</td><td><p>Added circular dependency check in the ParseExpression function.</p><p><mark style="color:red;"><strong>Note:</strong> this version is only supported on Stream Host v4.4.0 and v4.4.1.</mark></p></td></tr><tr><td>v3.43</td><td>26 Jun 2023</td><td><p>Fixed parsing error when braces are inside quotations.</p><p>Fixed parsing of column names used in an expression.</p></td></tr><tr><td>v3.42</td><td>07 Sep 2022</td><td>Repackaged to include the Agent's Category.</td></tr><tr><td>v3.41</td><td>28 Apr 2021</td><td>Fixed repetitive NEW_ prefixes added to an new column internally.</td></tr><tr><td>v3.40</td><td>13 Nov 2020</td><td>Added better error messages.</td></tr><tr><td>v3.39</td><td>26 Oct 2020</td><td>Grid converted to edit list and added multiline expression support.</td></tr><tr><td>v3.381</td><td>30 Jul 2021</td><td>Fixed repetitive NEW_ prefixes added to an new column internally using base code of v3.38. This is an interim version which doesn't support 'EditList' control available in latest XMIoT Framework.</td></tr><tr><td>v3.38</td><td>26 Oct 2020</td><td>Fix existing columns being deleted.</td></tr><tr><td>v3.37</td><td>06 Aug 2020</td><td>Fix to nested variable expressions when also using { }.</td></tr><tr><td>v3.35</td><td>15 Jul 2020</td><td>Added support for variable expressions using [ ].</td></tr><tr><td>v3.34</td><td>26 May 2020</td><td>Upgraded validation to check if each expression is valid.</td></tr><tr><td>v3.33</td><td>21 May 2020</td><td>Added proper hyphen support.</td></tr><tr><td>v3.31</td><td>13 May 2020</td><td>Added column name support for ' ', '_', and numbers at the start of the column.</td></tr><tr><td>v3.30</td><td>27 Feb 2020</td><td>Fixed issue with expression not parsing on start</td></tr><tr><td>v3.29</td><td>24 Feb 2020</td><td>Fixed expression parsing so users can use True/False properly for Boolean values.</td></tr><tr><td>v3.27</td><td>03 Feb 2020</td><td>Fixed issue where expressions replace a column's value.</td></tr><tr><td>v3.26</td><td>03 Feb 2020</td><td>Improved exception messages and fixed errors with Boolean expressions to support XMIoT Boolean Casing.</td></tr><tr><td>v3.25</td><td>27 Jan 2020</td><td>Reworked expression parsing to no longer be reliant on System.Dynamic.Linq.Core reflections.</td></tr><tr><td>v3.14</td><td>09 Sep 2019</td><td>Support using one calculated field in another calculated field's expression.</td></tr><tr><td>v3.13</td><td>09 Sep 2019</td><td>Fixed issues with Payload selection.</td></tr><tr><td>v3.12</td><td>04 Sep 2019</td><td>Upgraded System.Linq.Dynamic.Core.</td></tr><tr><td>v3.11</td><td>27 Aug 2019</td><td>Support specifying Existing With New or only New columns as output.</td></tr><tr><td>v3.10</td><td>04 Mar 2019</td><td><p>Added validation for field identifiers.</p><p>Added Error output when calculation fails.</p></td></tr><tr><td>v3.09</td><td>21 Jun 2019</td><td>Changed name to Calculated Field and updated icon.</td></tr><tr><td>v3.08</td><td>04 Mar 2019</td><td>Updated help URL</td></tr><tr><td>v3.07</td><td>22 May 2018</td><td>Fixed outputs that overwrite input fields not having the specified output type.</td></tr><tr><td>v3.06</td><td>11 May 2018</td><td>Added DateTime type to list of derived output types.</td></tr><tr><td>v3.05</td><td>10 May 2018</td><td>Fixed null-reference exceptions in GetOutputAttributes.</td></tr><tr><td>v3.04</td><td>10 May 2018</td><td>Fixed "ToInt is not a valid method" exception.</td></tr><tr><td>v3.03</td><td>10 May 2018</td><td>Fixed "Operator cannot be applied to operands of type Object and ..." exceptions.</td></tr><tr><td>v3.02</td><td>26 Apr 2018</td><td>Updated DLL.</td></tr><tr><td>v3.01</td><td>19 Apr 2018</td><td>Changed Agent state to Virtual.</td></tr><tr><td>v3.00</td><td>19 Apr 2018</td><td>Initial Release.</td></tr></tbody></table>
