Per the description of the node in the Help documentation:
"Uses Python scripting to apply an expression to fields in data attached to the input node, generating new fields in your data to store the results of the calculation."
The node was created to simplify the creation of new fields based on a simplified set of field constructs in the expression. Note that even with the Transform node, the creation of the node's output metadata is performed (by the ConfigureFields script) prior to the processing of the first record according to the logic in the ProcessRecords script. Because of this, it is not possible to used values in the input data to determine whether an output field is created by the node. the processing of a out1+=in1 statement in the ProcessRecords script will set the values of the output fields rather than manipulate the metadata.
------------------------------
Adrian Williams
Precisely Software Inc.
------------------------------
Original Message:
Sent: 02-22-2024 01:23
From: Henrik B
Subject: Calculate Fields Node
Hello everyone, a quick question.
Do i always have to create new output columns while i use calculate fields, it would be nice to use it for conditionals?
As an example, would it be possible to replicate the following from a transform node in Calculate fields, to have a conditional without creating a new column.:
import datetime
if in1.date1 < in1.date2:
out1+=in1
------------------------------
Henrik B
E.ON Sverige
------------------------------