Ask Your Question
1

How do I convert a field value to lower/upper case?

asked 2017-11-10 15:37:38 -0500

shelv gravatar image

I have a field that I need to convert to either lower or upper case, whats the easiest way to do so?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2017-11-10 15:55:37 -0500

shelv gravatar image

updated 2017-11-12 21:37:52 -0500

metadaddy gravatar image

Got it: str:toLower()/toUpper()

edit flag offensive delete link more
2

answered 2018-04-10 16:17:14 -0500

todd gravatar image

I wasn't able to get the field renamer to work with str:toLower/toUpper. I did find a suggestion to use Jython Processor (or equivalent in alternative language processor)

https://groups.google.com/a/streamset...

for record in records:
  try:
    for key in record.value.keys():
      record.value[key.lower()] = record.value[key]
      del record.value[key]

    output.write(record)
edit flag offensive delete link more
1

answered 2019-03-20 07:40:05 -0500

Roshan Summun gravatar image

The answer by todd is not 100% correct since it will delete existing lowercase keys. I had to modify it as follows:

for record in records:
    try:
        for key in record.value.keys():
            record.value[key.lower()] = record.value[key]
            if (key.islower() == False):
                del record.value[key]

        output.write(record)

    except Exception as e:
        # Send record to error
        error.write(record, str(e))
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-11-10 15:37:38 -0500

Seen: 424 times

Last updated: Apr 10 '18