Skip to content

C# transformation

Description

The transformation allows users to convert element values of particular datset by c# script expression. The transformation must specify applicable dataset items and c# script. Script must have a valid c# syntax whith variable of 'x' representing single element value being transformed. Currently no system references are available to the script. As of 04-08-2020, this transformation is applicable to multidimensional datasets.

Example

This request to /api/conversion/upload-convert

{
  "readerName": "<reader name>",
  "writerName": "<writer name>",
    ...
  "transformations": [
    {
        type: "CsScriptValueTransformation",
        csScript: "x + 273.15",
            Items : ["Temperature"]
    }
  ]
}
will convert values of item called "Temperature" from Celsius to Kelvin degree.

Please note that standard rules of C# compilation apply. For example, if your variable has only single precision (32-bit float), then the above example will produce an incompatible result type (64-bit float), so you will need to use explicit cast such as (float)(x + 273.15).

For more information refer to the swagger documentation of the Metadata service.