For anyone wanting to do this in bulk, there is a way but it's not via the use of tMap
.
Using one of the tJava#
components, you can use Reflection
in Java to do it dynamically for all fields of type String
.
This can be applied to any part of the transformation flow.
This is a basic example ...

The first step initialises 3 rows of data that look like thus ...

The main tJavaFlex
component looks like this (noting that the out connector for this component is named data_out
) ...
Start code
Class outClass = data_out.getClass();
java.lang.reflect.Field[] outFields = outClass.getDeclaredFields();
Main code
for (int i = 0; i < outFields.length; i++) {
java.lang.reflect.Field field = outFields[i];
String fieldType = field.getType().getSimpleName();
if (fieldType.equals("String")) {
field.setAccessible(true);
String value = (String)field.get(data_out);
if (value != null) {
String stringValue = value.toUpperCase();
field.set(data_out, stringValue);
}
}
}
... it's also important to note that the Data Auto Propogate flag should be switched on. This will automatically fill the output structure which means you won't have to. All the tJavaFlex component needs to do is uppercase each string value.
Output
Starting job DynamicUppercase at 09:06 24/03/2023.
[statistics] connecting to socket on port 3613
[statistics] connected
.------+------+-------+-------+--------+------+------+-------.
| Before |
|=-----+------+-------+-------+--------+------+------+------=|
|Text1 |Text2 |Number1|Number2|Boolean1|Text3 |Text4 |Number3|
|=-----+------+-------+-------+--------+------+------+------=|
|Test 1|test 2|123 |456 |true |test 3|Test 4|789 |
|Test 1|test 2|123 |456 |true |test 3|Test 4|789 |
|Test 1|test 2|123 |456 |true |test 3|Test 4|789 |
'------+------+-------+-------+--------+------+------+-------'
.------+------+-------+-------+--------+------+------+-------.
| After |
|=-----+------+-------+-------+--------+------+------+------=|
|Text1 |Text2 |Number1|Number2|Boolean1|Text3 |Text4 |Number3|
|=-----+------+-------+-------+--------+------+------+------=|
|TEST 1|TEST 2|123 |456 |true |TEST 3|TEST 4|789 |
|TEST 1|TEST 2|123 |456 |true |TEST 3|TEST 4|789 |
|TEST 1|TEST 2|123 |456 |true |TEST 3|TEST 4|789 |
'------+------+-------+-------+--------+------+------+-------'
[statistics] disconnected
Job DynamicUppercase ended at 09:06 24/03/2023. [Exit code = 0]