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 and supported operations.
Details for an example and its 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 the Calculated Field Transformation v3.45
Please contact XMPro if you're looking for an older version of this Agent.
Release Notes
v3.45, 10 Apr 2024
Downgraded Newtonsoft.Json to v11.0.1
Backward compatible with older Stream Host versions
v3.44, 29 Feb 2024
Added a circular dependency check in the ParseExpression function
Note: this version is only supported on Stream Host v4.4.0 and v4.4.1.
2023
v3.43, 26 Jun 2023
Fixed parsing error when braces are inside quotations
Fixed parsing of column names used in an expression
2022
v3.42, 07 Sept 2022
Repackaged to include the Agent's Category
Older
v3.41, 28 Apr 2021
Fixed repetitive NEW_ prefixes added to an new column internally
v3.40, 13 Nov 2020
Added better error messages
v3.39, 26 Oct 2020
Grid converted to edit list and added multiline expression support
v3.381, 30 Jul 2021
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
v3.38, 26 Oct 2020
Fix existing columns being deleted
v3.37, 06 Aug 2020
Fix to nested variable expressions when also using { }
v3.35, 15 Jul 2020
Added support for variable expressions using [ ]
v3.34, 26 May 2020
Upgraded validation to check if each expression is valid
v3.33, 21 May 2020
Added proper hyphen support
v3.31, 13 May 2020
Added column name support for ' ', '_', and numbers at the start of the column
v3.30, 27 Feb 2020
Fixed issue with expression not parsing on start
v3.29, 24 Feb 2020
Fixed expression parsing so users can use True/False properly for Boolean values
v3.27, 03 Feb 2020
Fixing issue where expressions replace a column's value
v3.26, 03 Feb 2020
Added better exception messages and fixed errors with Boolean expressions to support XMIoT Boolean Casing
v3.25, 27 Jan 2020
Reworked how expressions are parsed so it is no longer reliant on System.Dynamic.Linq.Core reflections
v3.14, 09 Sep 2019
Added the ability to use one calculated field in another calculated field's expression
v3.13, 09 Sep 2019
Fixed issues with Payload selection
v3.12, 04 Sep 2019
Upgraded System.Linq.Dynamic.Core
v3.11, 27 Aug 2019
Added option to specify Existing With New or only New columns as output
v3.10, 04 Mar 2019
Added validation for field identifiers
Added Error output when calculation fails
v3.09, 21 Jun 2019
Change name to Calculated Field and update icon
v3.08, 04 Mar 2019
Updated help URL
v3.07, 22 May 2018
Fixed outputs that overwrite input fields not having the specified output type
v3.06, 11 May 2018
Added DateTime type to list of derived output types
v3.05, 10 May 2018
Fixed null-reference exceptions in GetOutputAttributes
v3.04, 10 May 2018
Fixed "ToInt is not a valid method" exception
v3.03, 10 May 2018
Fixed "Operator cannot be applied to operands of type Object and ..." exceptions
v3.02, 26 Apr 2018
Updated DLL
v3.01, 19 Apr 2018
Changed Agent state to Virtual
v3.0, 19 Apr 2018
Initial Release
Last updated