About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Feb 11, 2025
You can use a
loop to loop through all the nodes in a
flow. For example, the following two script examples loop through all nodes and change field names
in any Filter nodes to uppercase.for
You can use this script in any flow that contains a Filter node, even if no fields are actually filtered. Simply add a Filter node that passes all fields in order to change field names to uppercase across the board.
# Alternative 1: using the data model nameIterator() function
stream = modeler.script.stream()
for node in stream.iterator():
if (node.getTypeName() == "filter"):
# nameIterator() returns the field names
for field in node.getInputDataModel().nameIterator():
newname = field.upper()
node.setKeyedPropertyValue("new_name", field, newname)
# Alternative 2: using the data model iterator() function
stream = modeler.script.stream()
for node in stream.iterator():
if (node.getTypeName() == "filter"):
# iterator() returns the field objects so we need
# to call getColumnName() to get the name
for field in node.getInputDataModel().iterator():
newname = field.getColumnName().upper()
node.setKeyedPropertyValue("new_name", field.getColumnName(), newname)
The script loops through all nodes in the current flow, and checks whether
each node is a Filter. If so, the script loops through each field in the node and uses either the
or field.upper()
function to change
the name to uppercase. field.getColumnName().upper()
Was the topic helpful?
0/1000