Python® Scripting block
The Python scripting block allows you to manipulate fields through a Python script, taking advantage of the capabilities provided by the Python® scripting language.
NOTE: CSense provides secure native blocks and operations for building analytics and solutions. The native capabilities provided by CSense can be extended by making use of this feature. When making use of this feature, please ensure that you have validated your extended functions to ensure that they perform as intended and do not introduce stability or security risks to your production system. Do not use scripts or components from untrusted sources.
Description
The Python® Scripting block allows you to introduce new fields or manipulate existing ones, by means of a script written in Python®. The value, timestamp, and quality of output fields are controlled by this script. The script is run from top to bottom every time the block executes.
Python® scripting block
Block Type
Rules and Models
Input ports
The input port can accept any number and any type of fields.
Output port
The number and types of output fields are determined by the block configuration.
Functions performed on tags
The values, timestamps and qualities of fields are controlled by the script. Value, timestamp and quality behavior changes as follows:
-
On the Values: During the first execution the output value is 0, or blank in the case of a string data field. Subsequent values are determined by the script. If the script does not set the values in subsequent executes, they remain unchanged from the previous execute.
-
On the Quality: During the first execution the quality of all output fields is bad. Subsequent qualities are determined by the script. If the script does not set the qualities in subsequent executes, they remain unchanged from the previous execute.
-
On the Timestamp: During the first execution, the timestamp is a value that is before any other possible timestamp. Subsequent timestamps are determined by the script. If the script does not set the timestamps in subsequent executes, they remain unchanged from the previous execute.
NOTE: Whenever the value or the quality of a field changes between consecutive executes, it is compulsory for that field’s timestamp to progress in time.
Related topics: