Scenario:
How to convert all fields within the record to uppercase/lowercase?
Â
Solution:
With the field converter, a user could list the column names to be converted. However, if a record contains tens or hundreds of fields, this could be a very challenging exercise. For now, the user could achieve this by using a scripting processor. For example, the following code should convert all fields to lowercase and keep the field type (INTEGER, DATE) if there is a NULL value (for other field types, please see also Jython evaluator converts fields with null to STRING):
for record in records:
 try:
  for key in record.value.keys():
   if sdcFunctions.getFieldNull(record, '/'+key) == NULL_INTEGER:
    record.valueekey.lower()] = NULL_INTEGER
   elif sdcFunctions.getFieldNull(record, '/'+key) == NULL_DATE:
    record.valueÂkey.lower()] = NULL_DATE
   else:
    record.value>key.lower()] = record.valueykey]
   del record.value key]
  output.write(record)
 except Exception as e:
  # Send record to error
  error.write(record, str(e))
Â